在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):cazzer/gulp-selectors开源软件地址(OpenSource Url):https://github.com/cazzer/gulp-selectors开源编程语言(OpenSource Language):JavaScript 98.3%开源软件介绍(OpenSource Introduction):This project is looking for a maintainerI am no longer maintaining this repository and would be happy to transfer it to someone who still actively uses it. Respond to the maintainer issue if you are interested in taking ownership. In case you are interested, I use css-modules now instead. gulp-selectors
You're like: UsageFirst and foremost:
var gulp = require('gulp');
var gs = require('gulp-selectors');
gulp.src(['src/**/*.css', 'src/**/*.html'])
.pipe(gs.run())
.pipe(gulp.dest('dist')); You can also pass some options into run:
CSS and HTML files are processed well by default, just pass in your glob of files and all classes and IDs will be reduced to a minified form. Of course you can use it for some more specific functions if you like. See the included sample gulpfile for a full example of how to effectively use gulp-selectors in your gulp workflow. DefaultsAll arguments are optional. If omitted, processors will default to gs.run({
'css': ['css'],
'html': ['html']
}, {
}); Advanced Usagevar processors = {
'css': ['scss', 'css'], // run the css processor on .scss and .css files
'html': ['haml'], // run the html processor on .haml files
'js-strings': ['js'] // run the js-strings plugin on js files
},
ignores = {
classes: ['hidden', 'active'] // ignore these class selectors,
ids: '*' // ignore all IDs
};
gs.run(processors, ignores); Two processors are built in for your convenience:
If a processor is listed which isn't built in, gulp-selectors will attempt to How gulp-selectors worksCalling Processors{
'css': ['css', 'scss'],
'html': ['html', 'tpl.js'],
'js-strings': ['js', '!tpl.js'],
'your-custom-processor': ['.ext']
}
processor(file, classLibrary, idLibrary)
libraries Ignores{
ids: ['content', 'target'],
classes: ['hidden', 'active']
} |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论