Skip to content
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

gulp-less print out nothing error in case extend a non-existing mixin #206

Closed
cnweibo opened this issue Dec 5, 2015 · 9 comments
Closed

Comments

@cnweibo
Copy link

cnweibo commented Dec 5, 2015

Hi, I have posted a thread in stackoverflow about gulp-less. I want to know how to deliver error information when an error happens during extend a non-existing mixing/class.
http://stackoverflow.com/questions/34107876/is-there-any-way-to-let-gulp-less-print-error-in-case-extend-a-non-existing-mixi

Can you have a look and give me clue. Following is copied from stackoverflow:

In my less build process, i use the gulp-less. In the build process, i use gulp-plumber to print out error information during that build. It works well for the less syntax error, reference to non-exist variables. Unfortunately, the gulp-less build task print out nothing in case we extend a non-existing mixin/class. Does anyone know about how to enable such kind of "error" or even warning during the build? Following is the gulpfile:
gulp.task('less',function(){
var pagelessentry = config.pagelessentry;
log(pagelessentry);
return gulp
.src(pagelessentry)
.pipe(plumber({
errorhandler: errorhandler
}))
.pipe(debug({
title: 'LESS'
}))
.pipe(sourcemaps.init())
.pipe(less())
.pipe(uncss({
html: ['index.html', 'http://homestead.app'],
ignore: [/header-down/,/header-up/]
}))
.pipe(sourcemaps.write(projectrootdir+'public/preparebuild/assets/css/',{includeContent: true}))
.pipe(gulp.dest(projectrootdir+'public/preparebuild/assets/css/'));
});
Following is the "wrong" less code where i want gulp to print out some "error or warning" information:
.footer{
background-color: @primary-background;
&:extend(.NONEXISTING all);
}
In above code, when we extend .NOEXISTING mixin, nothing printed out.
It is quite annoying thing.
Please help me out
Thanks~!

@yocontra
Copy link
Member

yocontra commented Dec 5, 2015

Does this happen with the less command line as well?

@cnweibo
Copy link
Author

cnweibo commented Dec 6, 2015

@contra , for the lessc itself, it really dump out an warning when extending a non-existing class.
according to http://stackoverflow.com/questions/31751746/show-warnings-when-extend-is-missing-base-class/31759983#31759983 , someone tells gulp-less should implement a dedicated support for such warnings (there was no "warnings-facility" in Less before).
As i know, grunt-contrib-less also can not print out these warning.
Can you give more information how can i let that happen in gulp-less?
This is really useful since no glue to know what happens when that happen.
Thanks!

@cnweibo
Copy link
Author

cnweibo commented Dec 6, 2015

@contra , i have run in the linux command line with lessc --lint, it really printed out the missed extended class as follows(.clearfix can not be found when extend it!):

vagrant@homestead:~/nodewrapper$ lessc --lint /home/vagrant/Code/kidsit/resources/assets/less/style.less 
extend ' .clearfix' has no matches
extend ' .clearfix' has no matches
extend ' .clearfix' has no matches

@yocontra
Copy link
Member

yocontra commented Dec 6, 2015

This seems like an issue where less is not reporting errors back via the JS API. You should open an issue with less so they can add this in.

@cnweibo
Copy link
Author

cnweibo commented Dec 6, 2015

ok, i have opened an issue on less repo. Hope they can have a investigation. But currently, they have not admit, it is less itself's issue.

@cnweibo
Copy link
Author

cnweibo commented Dec 7, 2015

@contra , please see reply from less guys, it seems that the less compiler itself has exported the warnings to tooling. So, i think, if gulp-less accept some configuration parameter, this can work.
less/less.js#2753 (comment)
Please see the demo code they provide for information here.

@yocontra
Copy link
Member

yocontra commented Dec 9, 2015

@cnweibo Do you want to send a PR to add this? We don't use the less module directly, we use accord which doesn't give us access to this stuff. It will probably need to be added to accord then we can add a warning event from this plugin

@cnweibo
Copy link
Author

cnweibo commented Dec 13, 2015

@contra , sorry, i do not know how to let this issue fix by accord.
Can you tell me what is the repo of accord, i can submit the issue to them to fix it. Or..can you kindly submit an issue to accord?

Thanks~!

@yocontra
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants