Hi I'm getting an error starting 'gulp default' with the following gulp file. I cannot figure out whats wrong with the file.
var gulp = require('gulp');
var sass = require('gulp-sass');
var sourcemaps = require('gulp-sourcemaps');
var autoprefixer = require('gulp-autoprefixer');
var browserSync = require('browser-sync').create();
var input = './scss/**/*.scss';
var output = './css';
gulp.task('sass', function() {
return gulp.src(input)
.pipe(sourcemaps.init())
.pipe(sass(errLogToConsole: true, outputStyle: 'compressed'))
.pipe(autoprefixer(browsers: ['last 2 versions', '> 5%', 'Firefox ESR']))
.pipe(sourcemaps.write())
.pipe(gulp.dest(output))
.pipe(browserSync.stream());
});
// Watch files for change and set Browser Sync
gulp.task('watch', function() {
// BrowserSync settings
browserSync.init({
proxy: "mydomain.loc",
files: "./css/styles.css"
});
// Scss file watcher
gulp.watch(input, ['sass'])
.on('change', function(event) {
console.log('File' + event.path + ' was ' + event.type + ', running tasks...')
});
});
// Default task
gulp.task('default', ['sass', 'watch']);
I've allready reinstalled node and all the package won't solve the problem though.
See Gulp Sass with errLogToConsole: true still stopping my other watch tasks and Gulp-generated source maps don't work in Chrome.
Don't use errLogToConsole it doesn't appear to be supported anymore.
Change that to
.pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError))
as in gulp-sass options. Your earlier error was probably due to not including your options in {} braces (it is an object).
[EDIT] :
And your other error is the same
should be
Note the curly braces. Usually the options to gulp plugins are objects so they need to be wrapped in braces {}.