-
Notifications
You must be signed in to change notification settings - Fork 867
adding the UNCSS task in my gulpfile.js #727
Comments
You would want to make the sass task a dependency of uncss so that uncss runs after the Sass task is complete. I belive you are getting that error because the sass task has not completed compilation of the CSS file. gulp.task('uncss', ['sass'], function() {
return gulp.src('assets/stylesheets/foundation.css')
.pipe(uncss({
html: [
'http://192.168.1.90/e-leeze/',
'http://192.168.1.90/e-leeze/saude',
'http://192.168.1.90/e-leeze/arquivo',
'http://192.168.1.90/e-leeze/mais-visualizadas/'
]
}))
.pipe(gulp.dest('assets/stylesheets'));
}); After you change that, get rid of the |
thanks @colin-marshall ! my task now looks like this:
|
Nice, did that work for you? |
It is working, I don't know if is the best solution. There is a better way to skip this from the watch when I'm not using the flag |
You could probably combine the uncss task into the Sass task, but I wouldn't necessarily say it's a better approach. Just a different way of accomplishing the same thing. On a side note you should look at the Foundation Zurb Template's gulpfile. It has some ignore rules for uncss that you should add so that classes that are added to the page after pageload are not removed from your CSS. |
I'll take a look on this! |
I have discovered a ton of errors using uncss. I'm not saying that it is useless in all cases, but be aware that in some cases it can remove styling that you actually need. My approach is to comment out styling associated with the components that I do not use. But having said that, was your problem solved? Can we close this issue? |
Thanks for the alert @olefredrik, I will use it with caution. And you can close the issue. |
Hello, I'm starting to use the foundationpress, and I have no experience with Gulp.
I'm finishing my first site using it and I want to run uncss to get a smaller css file.
I added this task:
changed the build task:
than I changed the watch function:
when I run
npm run watch
it run ok, but when I change some scss file it crashes generating this error:but I can't see the file
/Applications/MAMP/htdocs/e-leeze/wp-content/themes/eleeze/npm-debug.log
Someone could help me?
Thanks!
The text was updated successfully, but these errors were encountered: