在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):massick/gulp-strip-code开源软件地址(OpenSource Url):https://github.com/massick/gulp-strip-code开源编程语言(OpenSource Language):JavaScript 98.9%开源软件介绍(OpenSource Introduction):gulp-strip-codeThe gulp-strip-code plugin is used to remove sections of code. Usefull to remove code from production builds that are only needed in development and test environments, or to remove custom internationalized information. This plugin uses start and end comments to identify the code sections to strip out. For example:
/*! i18n EN start */
.onlyEnStyle {
color: red;
}
/*! i18n EN end */
.otherStyle {
color: red;
} /* test-code */
removeMeInProduction();
/* end-test-code */
doNotRemoveMe(); Getting StartedFirst, install npm install gulp-strip-code The "strip_code" taskOverviewAdd to your var stripCode = require('gulp-strip-code');
gulp.task('templates', function(){
gulp.src(['file.txt'])
.pipe(stripCode({
start_comment: "start-test-block",
end_comment: "end-test-block"
}))
.pipe(gulp.dest('build/file.txt'));
}); Optionsoptions.start_commentType: The text inside the opening comment used to identify code to strip. options.end_commentType: The text inside the closing comment used to identify code to strip. options.keep_commentsType: Sets the behaviour to keep the identifying comments or not. Setting a truthy value for keep_comments will enable it. options.patternType: If the default start and end comment matching doesn't work for you needs, you can supply your own RegExp to match against. If the options.comment_allType: Remove a whole comment block. Testsnpm test ContributingIn lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code. Release History
License |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论