-
Notifications
You must be signed in to change notification settings - Fork 40
parse html recursively in folder #5
Comments
The html option is passed straight through to UnCSS; I agree that this is a good feature, but you would be better off submitting it to the UnCSS issue tracker; that way other plugins that consume UnCSS (such as grunt-uncss), and UnCSS itself can benefit. This plugin is just a streamy wrapper around the UnCSS module. |
thank you ben-ed, I've submit a new feature > uncss/uncss#51 |
Thanks for the suggestion, but it's probably better to implement at plugin-level. Doesn't gulp have a way to preprocess "star-paths" like grunt? |
Sure, both systems use minimatch. I suggested that this is probably better at the module level because then the other libraries that consume UnCSS can benefit and not just my wrapper; as of this writing:
Plus we don't know if there will be some other task in the future that will want this functionality. |
See also: uncss/grunt-uncss#64 |
Wow, I didn't even imagine there were so many wrapper for uncss! |
In the mean time, you can use glob.sync() which do exactly what you need here : take a glob pattern and turn it in an array of matched files.
var glob = require('glob');
gulp.task('uncss', function() {
gulp.src('static/css/vendor/bootstrap.min.css')
.pipe(uncss({
html: glob.sync('templates/**/*.html')
}))
.pipe(gulp.dest('static/css'));
}); And if you need to glob multiple patterns, you can use lodash or underscore Edit: I have here the very setup I'm talking about. |
@p-j That's awesome, thanks! |
@p-j just swinging by to thank you for the idea - works great :) |
Happy to help :) @ben-eb I've seen you refer to my comment on several occasion, maybe adding a corresponding example in the readme could clear things up ? |
@p-j 👍 |
hi,
I have 62 templates in folders and subfolders
How can I specify to uncss to read all the html in a specific folder ?
this work:
with a regex it doesn't:
Any idea ?
The text was updated successfully, but these errors were encountered: