gulp-mds-helper 2.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +0 -0
- package/README.md +0 -0
- package/index.js +38 -0
- package/package.json +28 -0
package/LICENSE
ADDED
|
File without changes
|
package/README.md
ADDED
|
File without changes
|
package/index.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var through = require('through2');
|
|
4
|
+
var PluginError = require('plugin-error');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var replacer = (options)=>{
|
|
8
|
+
return through.obj(function (file, enc, cb) {
|
|
9
|
+
|
|
10
|
+
if (file.isNull()) {
|
|
11
|
+
cb(null, file);
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
if (file.isStream()) {
|
|
15
|
+
cb(new PluginError("gulp-remove-keep", "Streaming not supported."));
|
|
16
|
+
}
|
|
17
|
+
var fileString = file.contents.toString()
|
|
18
|
+
|
|
19
|
+
// HTML
|
|
20
|
+
if(file.path.toLowerCase().endsWith("html")){
|
|
21
|
+
var arr = fileString.split("mds-helper=")
|
|
22
|
+
fileString = arr.map((line,index)=>{
|
|
23
|
+
var mark = Math.floor(Math.random()*100000000)
|
|
24
|
+
if(index<(arr.length-1))
|
|
25
|
+
return `${line} data-mark='${mark}' `
|
|
26
|
+
else
|
|
27
|
+
return line
|
|
28
|
+
}).join("mds-helper=")
|
|
29
|
+
|
|
30
|
+
}
|
|
31
|
+
file.contents = new Buffer(fileString, options);
|
|
32
|
+
this.push(file);
|
|
33
|
+
return cb();
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
module.exports = replacer;
|
package/package.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "gulp-mds-helper",
|
|
3
|
+
"description": "Strip comments from code",
|
|
4
|
+
"version": "2.5.2",
|
|
5
|
+
"authors": [
|
|
6
|
+
"Abdullah Nouraldaim <abdullah_1225@yahoo.com>"
|
|
7
|
+
],
|
|
8
|
+
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"plugin-error": "^0.1.2",
|
|
11
|
+
"through2": "^2.0.3"
|
|
12
|
+
},
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"coveralls": "^2.13.1",
|
|
15
|
+
"istanbul": "^0.4.5",
|
|
16
|
+
"jasmine-node": "^1.14.5",
|
|
17
|
+
"vinyl": "^2.1.0"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"index.js"
|
|
21
|
+
],
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"scripts": {
|
|
24
|
+
"test": "jasmine-node test",
|
|
25
|
+
"coverage": "istanbul cover ./node_modules/jasmine-node/bin/jasmine-node test",
|
|
26
|
+
"travis": "istanbul cover ./node_modules/jasmine-node/bin/jasmine-node test --captureExceptions && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage"
|
|
27
|
+
}
|
|
28
|
+
}
|