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'));
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
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 () {
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With