less-plugin-clean-css
less-plugin-clean-css copied to clipboard
Windows error runing via gulp: Potentially unhandled rejection [2] Error: ENOENT, $stdin
Hi
I get the following error when running less-plugin-clean-css via gulp windows:
Potentially unhandled rejection [2] Error: ENOENT, open 'C:\SOME\PATH\$stdin'
at Error (native)
No error in OS X.
My gulp task
var less = require("gulp-less");
var LessPluginCleanCSS = require("less-plugin-clean-css");
var sourcemaps = require("gulp-sourcemaps");
gulp.task(taskName, function () {
var lessArgs = {};
lessArgs.plugins = [];
// if I remove the following line, I don't get any errors
lessArgs.plugins.push(new LessPluginCleanCSS({ advanced: true }));
return gulp
.src("/PTH/TO/CSS/**/main.less")
.pipe(sourcemaps.init())
.pipe(less(lessArgs))
.pipe(sourcemaps.write("PTH/TO/JS"))
.pipe(gulp.dest("htdocs/css/"));
});
Any ideas? Thanks in advance.
Sorry, no ideas! Possibly something to do with sourcemaps? if you take that out and leave the plugin in, does it work?
I'm experiencing the same error in Windows. If either sourcemaps or clean-css is removed, then it works. Also, in the Less I've place a multi-line comment at the top. If this comment is removed or changed to be a single line comment, then everything works.
/*
Test
*/
.test {color:red;}
Here is a simple gist with the code I'm using: https://gist.github.com/Kruegs/3b4b720f9fe36f1d6532
Does this help anyhow, guys? https://github.com/jakubpawlowicz/clean-css/issues/593#issuecomment-117538125
@jakubpawlowicz There's exactly the same problem with less-plugin-autoprefix (see the referenced issue above). So aparently it's some weird incompatibility in how gulp-less and these plugins handle sourcemaps but it's hard to say for sure w/o deeper tests/debugging (unfortunately it looks like neither @lukeapage nor me actually use gulp so it may take for a while until we'll get to this to investigate... Unless someone else would be so kind to take it. :)
I use gulp in some projects with less-plugin-clean-css and autoprefix on windows, and haven't had any problems. then again I haven't switched on sourcemaps either as they don't need it yet.
I suspect the problem is that gulp uses streams - which should be fine since the gulp-plugin can wrap less and use it like an asynchronous stream. I've reviewed this plugin and less.js and I can't see anywhere that less-node write the sourcemap - its only done by lessc, so that means it's either gulp, gulp-less, clean-css or the sourcemaps code.
Someone who gets the error needs to debug, but it doesn't look to me like less is doing anything incompatible.
for the interested, https://github.com/jakubpawlowicz/clean-css/issues/593 has part of an analysis, @jakubpawlowicz will investigate next
Same error here, removing the less plugins or sourcemaps makes it work again.
For now, I'm enabling one or the other depending if it's for debug or release
Getting similar issue on windows only. any updates?
@seven-phases-max I have some knowledge of gulp, although like everyone else here, I'm limited on time.
I wonder what it would take for Less to simply be Gulp-compatible, which would eliminate the need for gulp-less and alleviate some of the back and forth of an issue like this.
to be clear, this is a clean css issue and needs ti be investigated and fixed there. see the linked issue above.
Ah.
I'm seeing it without gulp-clean-css, just using gulp-sourcemaps together with gulp-less is enough.