Reputation: 43
I am trying to understand Gulp. I am on a Windows platform.
I have a simple gulpfile.js
- but I keep getting
SyntaxError. Unexpected token/identifier
I think it is saying identifier gulp
is wrong but not sure. If it is, I'm not sure how I should set-up the gulpfile
or what identifier to use
Sorry I can't post picture of log -- Here is gulpfile code
var gulp = require('gulp');
var uglify = require('gulp-uglify');
gulp.task('scripts', function () {
gulp.src('assets/js/*.js')
.pipe(uglify())
.pipe(gulp.dest('build/assets/js'));
});
gulp.task('styles', function () {
gulp.src('assets/css/*.css')
.pipe(uglify())
.pipe(gulp.dest('build/assets/css'));
});
gulp.task('default', ['scripts', 'styles']
gulp.src('assets/js/*.js')
.pipe(uglify())
.pipe(gulp.dest('build/assets/js'));
Upvotes: 3
Views: 22810
Reputation: 43
Thanks - Yes, I missed function() - now gulp gives a ReferenceError: uglyfly is not defined. Here is code again
var gulp = require('gulp'),
uglify = require('gulp-uglify');
gulp.task('scripts', function() {
gulp.src('assets/js/*.js')
.pipe(uglyfly())
.pipe(gulp.dest('build/assets/js'))
});
gulp.task('styles', function() {
gulp.src('assets/css/*.css')
.pipe(uglyfly())
.pipe(gulp.dest('build/assets/css'))
});
gulp.task('default', ['scripts', 'styles'], function () {
});
Upvotes: 1
Reputation: 6527
gulp.task('default', ['scripts', 'styles'], function(){
gulp.src('assets/js/*.js')
.pipe(uglify())
.pipe(gulp.dest('build/assets/js'));
});
add function(){ /*logic*/ });
you missed this in default
Upvotes: 3