-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Less compilation doesn't break on missing variable #118
Comments
Please run the files through the less CLI. |
^ Check to see if this reproduces on the CLI. If so file the issue on the less repo, if not it is a problem with the plugin and we will handle it here |
Indeed it looks like a gulp-less issue, as using
|
So an undefined variable is not printing an error to the console. Can you post the logs from when this happens? |
Here's my gulp log. Notice how CSS never finishes and Default never starts. I've edited it down since tests print to the console and yada yada yada.
And here's my gulpfile for css and default tasks: gulp.task('default', [ 'css', 'templates', 'images', 'scripts', 'test', 'browser-sync' ], function () {
'use strict';
process.stdout.write( 'The app has been gulped successfully\n' );
gulp.watch(src.lib + 'less/**/*.less', ['css']);
gulp.watch(src.lib + 'templates/**/**/*.ejs', ['templates']);
gulp.watch(src.lib + 'js/**/*.js', ['scripts','test']);
gulp.watch(src.lib + 'img/**/*', ['images']);
}); gulp.task('css', function () {
return gulp.src(src.lib + 'less/' + src.project + '.less')
.pipe(less({
sourceMap: true,
ie8compat: true
}))
.pipe( csslint({
'box-model': false,
'universal-selector': false,
'regex-selectors': false,
'unqualified-attributes': false,
'box-sizing': false,
'unique-headings': false,
'qualified-headings': false,
'font-sizes': false,
'important': false,
'overqualified-elements': false,
'duplicate-properties': false,
'duplicate-background-images': false,
'outline-none': false,
'adjoining-classes': false,
'floats': false,
'text-indent': false,
'known-properties': false, // see https://github.com/stubbornella/csslint/issues/283 for why we had to add this, it's stupid
'gradients': false, // our less mixin doesn't support the old webkit gradient syntax, so we're silencing this for now
'font-faces': false // This has a max allowance of 10 font face declarations, which doesn't make sense for proper font families. Silencing
}))
.pipe( csslint.reporter() )
.pipe(cssmin({
showLog: true
}))
.pipe(gulp.dest(cwd + 'lib/css/'))
.pipe(notify({
message: 'CSS gulped successfully'
}));
}); |
Can you get me just the output of running |
Also you should use gulp-sourcemaps, sourceMap: true to less won't really work the way you think |
I understand that sourcemap was deprecated in v2, just haven't had time to switch it out :) As for the log, It's a little hard to provide a good example for you, since my team is dependent on the
|
@mike-engel Is that with the error still in the less code? |
Yeah. If I run the default task, the css task never finishes. If I run it with the CLI, it errors out. |
i have the same problem i have define variables it always go in my style task never comes out without defining variables its work fine. its not giving error on any undefined variable. |
Update: This also seems to be happening with @imports that can't find the source file. |
Doing some debugging tonight, and it seems as though this may be a bug with one of gulp-less' dependencies and not gulp-less itself. If I replace the return with a |
I added the following in gulpfile.js as an interim fix gulp.src('app.less')
.pipe(less({
compress: true
}))
.on('error', function(err) {
console.log(chalk.red('Error with LESS.js'), err.message);
})
.pipe(gulp.dest('.')); This prints an error through Alternatively, tying it to LESS to ^1.3.7 also works. |
Might be a problem with https://github.com/plus3network/gulp-less/blob/master/index.js#L72 Using the callback pattern has some weird behavior nobody has been able to track down. Can you try replacing that with a |
@contra no good. Only process.exit() will completely stop the gulp process so far. |
@mike-engel Wait you don't have a watch open or something right? Tasks are supposed to be able to fail and not crash the process. If a task failed and the process died while you had other shit going on that would be a bug. Not crashing is expected behavior unless there is nothing else being processed |
I think you are conflating different things here
Lets focus on number 1 and not go off into the weeds. #2 is expected behavior. |
Well @contra, gulp-less < 2.0.0 did both on an error. It would report the error as well as kill the process. I'm fine with either of those scenarios, but changing the cb to the emit didn't report the error either. |
I'm using v2.0.1, and also experienced 'issue number 1'; I had a simple error when I was testing things out, and gulp-less didn't output anything. gulp-less v: 2.0.1 The gulp task (called by using 'gulp concat-css' from the command line):
Gulp's output:
The .less file, test.less:
The error output for lessc:
|
I don't understand what's doing in the index.js cb(error) since we can't see the error. why not just use |
here is the problem : plugin catch error & pass to the callback & no error show on console |
I have a test case that is reproducing this but I have no idea why the error isn't ending the stream - looking into it, no need to keep bumping this thread and sending everyone notifications |
fixed in 2.0.3 |
thanks for fixing |
Not sure if this issue should be here or in the less repo, but here it is. I recently did a lot of refactoring and after deleting a certain file, the less task would never finish, which would cause more problems in the default task as you can imagine. After going through all the changes, I found that I had deleted a variable that was used in another file. Even though less should have thrown an error about a missing variable, it didn't.
I'm not sure if I've missed something with less 2.0.0 or if this is a bug between one or both repos.
Thanks!
The text was updated successfully, but these errors were encountered: