Closed stevenvachon closed 8 years ago
What's your Less version?
I was using the latest version before switching to this.
I use a plugin that I wrote called less-plugin-future-compat. Perhaps it's not getting loaded in via plugins
in lessOptions
?
I'm also using gulp v4 (git+https://git@github.com/gulpjs/gulp.git#4.0
)
It should be passing the options as is to the Less compiler. Are you setting Less as the parser?
I thought that this library already did that. The documentation doesn't have an example that specifies a different parser.
@stevenvachon This plugin provides both a "postcss plugin" and a "postcss custom parser", so when sending to PostCSS, you need to specify both.
What would the code look? This is from the documentation and does not work:
var postcss = require('gulp-postcss');
gulp.task('less', function () {
return gulp.src('./css/src/style.less').pipe(
postcss([
require('postcss-less-engine')({ /* Less.js options */ })
])
).pipe(
gulp.dest('./css')
);
});
You're right, I think the doc is incorrect. The correct usage should be (I believe):
var postcss = require('gulp-postcss');
var less = require('postcss-less-engine');
gulp.task('less', function () {
return gulp.src('./css/src/style.less').pipe(
postcss([
less({ /* Less.js options */ })
], { parser: less.parser })
).pipe(
gulp.dest('./css')
);
});
Can you verify?
Still getting "unknown word".
TypeError: Cannot read property 'name' of undefined
at LazyResult.handleError (/project/node_modules/postcss/lib/lazy-result.js:89:22)
at /project/node_modules/postcss/lib/lazy-result.js:127:31
at runMicrotasksCallback (internal/process/next_tick.js:58:5)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickDomainCallback (internal/process/next_tick.js:122:9)
Thanks, this was definitely a bug. The file stream provided by Gulp was being interpreted by this plugin as non-input. Fixed and published. The first part of your bug report was indeed the parser not being set.
It works now. Thanks!
It appears to be choking on line comments: