Closed elimc closed 9 years ago
I'm attempting to get autoprefixer working with my setup. Here is the relevant gulpfile section:
// Compile Sass file to CSS, and updates browsers. gulp.task('sass', function() { return gulp.src(sassSource) .pipe(plumber()) .pipe(sourcemaps.init()) // Process the original sources .pipe(autoprefixer, { browsers: [ 'last 2 versions', 'ie 8', 'ie 9', 'android 2.3', 'android 4', 'opera 12' ] }) .pipe(sass({outputStyle: 'compressed'})) .pipe(sourcemaps.write('./')) // Add the map to modified source. .pipe(gulp.dest(sassDestination)) .pipe(reload({stream:true})); });
Here is the error message:
TypeError: Object function (opts) { return through.obj(function (file, enc, cb) { if (file.isNull()) { cb(null, file); return; } if (file.isStream()) { cb(new gutil.PluginError('gulp-autoprefixer', 'Streaming not supported')); return; } var fileOpts = objectAssign({}, opts); var processor = postcss() .use(autoprefixer(fileOpts)) .process(file.contents.toString(), { map: file.sourceMap ? {annotation: false} : false, from: file.path, to: file.path }); processor.then(function (res) { file.contents = new Buffer(res.css); if (res.map && file.sourceMap) { applySourceMap(file, res.map.toString()); } var warnings = res.warnings(); if (warnings.length > 0) { gutil.log('gulp-autoprefixer:', '\n ' + warnings.join('\n ')); } cb(null, file); }).catch(function (err) { var cssError = err.name === 'CssSyntaxError'; if (cssError) { err.message = err.message + err.showSourceCode(); } // prevent stream unhandled exception from being suppressed by Promise setImmediate(cb, new gutil.PluginError('gulp-autoprefixer', err, { fileName: file.path, showStack: !cssError })); }); }); } has no method 'on' at DestroyableTransform.Readable.pipe [as _pipe] (/Applications/AMPPS/www/jump_start/wp-content/themes/jumpstart/node_modules/gulp-sourcemaps/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:516:8) at DestroyableTransform.pipe2 (/Applications/AMPPS/www/jump_start/wp-content/themes/jumpstart/node_modules/gulp-plumber/index.js:70:20) at Gulp.gulp.task.gulp.src.pipe.pipe.pipe.reload.stream (/Applications/AMPPS/www/jump_start/wp-content/themes/jumpstart/gulpfile.js:46:14) at module.exports (/Applications/AMPPS/www/jump_start/wp-content/themes/jumpstart/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:34:7) at Gulp.Orchestrator._runTask (/Applications/AMPPS/www/jump_start/wp-content/themes/jumpstart/node_modules/gulp/node_modules/orchestrator/index.js:273:3) at Gulp.Orchestrator._runStep (/Applications/AMPPS/www/jump_start/wp-content/themes/jumpstart/node_modules/gulp/node_modules/orchestrator/index.js:214:10) at Gulp.Orchestrator.start (/Applications/AMPPS/www/jump_start/wp-content/themes/jumpstart/node_modules/gulp/node_modules/orchestrator/index.js:134:8) at /usr/local/lib/node_modules/gulp/bin/gulp.js:129:20 at process._tickCallback (node.js:419:13)
I don't really know what this error means. However, I have narrowed things down. It works If I comment out the following in my style.scss:
//@import "../bower_components/foundation/scss/foundation";
Autoprefixer is a function. Don't pass the options to the pipe. Use StackOverflow for support questions.
I'm attempting to get autoprefixer working with my setup. Here is the relevant gulpfile section:
Here is the error message:
I don't really know what this error means. However, I have narrowed things down. It works If I comment out the following in my style.scss: