在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):RnbWd/gulp-strip-comments开源软件地址(OpenSource Url):https://github.com/RnbWd/gulp-strip-comments开源编程语言(OpenSource Language):JavaScript 100.0%开源软件介绍(OpenSource Introduction):gulp-strip-comments
Features
The library does not support mixed content - HTML with JavaScript or CSS in it. Once the input code is recognized as HTML, only the HTML comments will be removed from it. PerformanceFor JSON and JavaScript this library uses [esprima] to guarantee correct processing for regular expressions. As an example, it can process AngularJS 1.5 Core in under 100ms, which is 1.1MB ~ 30,000 lines of JavaScript. Install$ npm install --save-dev gulp-strip-comments Usagevar gulp = require('gulp');
var strip = require('gulp-strip-comments');
gulp.task('default', function () {
return gulp.src('template.js')
.pipe(strip())
.pipe(gulp.dest('dist'));
}); APISee decomment for examples and more information.
strip(options)This method first checks if the code starts with When the If [esprima] fails to validate the code, it will throw a parsing error. When successful, this method will remove
options.safe ⇒ Boolean
options.ignore ⇒ RegExp | [RegExp,...]Takes either a single or an array of regular expressions to match against. All matching blocks are then skipped, as well as any comment-like content inside them. Examples:
src: url(data:font/woff;base64,d09GRg//ABAAAAAAZ) You can isolate all {ignore: /url\([\w\s:\/=\-\+;,]*\)/g}
{ignore: /\/\*\*\s*\n([^\*]*(\*[^\/])?)*\*\//g} options.space ⇒ Boolean
NOTE: When this option is enabled, option options.trim ⇒ Boolean
NOTE: This option has no effect when option strip.text(options)Unlike the default strip method, it instructs the library that This method is good for any text file that uses syntax Please note that while the same rules apply for the text blocks ( strip.html(options)Unlike the default strip method, it instructs the library not to parse
or validate the input in any way, rather assume it to be HTML, and remove all
strip.getEOL()Returns End-of-Line string used within the
When impossible to conclude (the same or 0 occurrence), it returns the default End-of-Line for the current OS. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论