less-plugin-autoprefix plugin with Gulp showing error -
the less-plugin-autoprefixer
plugin readme says that, use plugin, include in gulpfile.js:
var lesspluginautoprefix = require('less-plugin-autoprefix'), autoprefixplugin = new lesspluginautoprefix({browsers: ["last 2 versions"]}); less.render(lessstring, { plugins: [autoprefixplugin] }) .then(
do want me put open ended callback function here? i'm confused. tried including first part:
var lesspluginautoprefix = require('less-plugin-autoprefix'), autoprefixplugin = new lesspluginautoprefix({browsers: ["last 2 versions"]});
and called plugin this:
gulp.task('less', ['clean'], function() { return gulp.src('app.less') .pipe(less({ includepaths: ['less'], plugins: [autoprefixplugin] //***// })) .pipe(cssmin({keepspecialcomments: 0})) .pipe(rename('app.full.min.css')) .pipe(gulp.dest('../server/dist/')) .pipe(filter('../server/dist/**/*.css')) .pipe(reload({stream:true})); });
but receive following error:
typeerror: object #<autoprefixer> has no method 'on' @ destroyabletransform.stream.pipe (stream.js:65:8) @ gulp.<anonymous> (/users/himmel/sites/matt-mcdaniel.com/client/gulpfile.js:131:10)
i've included necessary dependency, autoprefixer-core
, missing here?
the error thrown unknown reason due inclusion of:
var autoprefixer = require('autoprefixer-core');
after removing this, no error thrown.
additionally, including:
var lesspluginautoprefix = require('less-plugin-autoprefix'), autoprefixplugin = new lesspluginautoprefix({browsers: ["last 2 versions"]});
and
gulp.task('less', ['clean'], function() { return gulp.src('app.less') .pipe(less({ includepaths: ['less'], plugins: [autoprefixplugin] //***// })) .pipe(cssmin({keepspecialcomments: 0})) .pipe(rename('app.full.min.css')) .pipe(gulp.dest('../server/dist/')) .pipe(filter('../server/dist/**/*.css')) .pipe(reload({stream:true})); });
was sufficient gulpfile autoprefix on build, did not autoprefix via browsersync
during development.
Comments
Post a Comment