gulp-file-include
Advanced tools
Comparing version 0.10.0 to 0.11.0
'use strict'; | ||
var concat = require('concat-stream'), | ||
flatten = require('flatnest').flatten, | ||
merge = require('merge').recursive, | ||
@@ -95,6 +96,10 @@ through = require('through2'), | ||
// grab keys & sort by longest keys 1st to iterate in that order | ||
var keys = Object.keys(data).sort(); | ||
var variables = flatten(data); | ||
var keys = Object.keys(variables).sort(); | ||
var i = keys.length - 1; | ||
var key; | ||
for ( ; ~i; i -= 1) { | ||
text = text.replace(new RegExp(prefix + keys[i] + suffix, 'g'), data[keys[i]]); | ||
if(key = keys[i]) { | ||
text = text.replace(new RegExp(prefix + key + suffix, 'g'), variables[key]); | ||
} | ||
} | ||
@@ -101,0 +106,0 @@ |
{ | ||
"name": "gulp-file-include", | ||
"version": "0.10.0", | ||
"version": "0.11.0", | ||
"description": "a gulp plugin for file include", | ||
@@ -41,6 +41,11 @@ "main": "index.js", | ||
"concat-stream": "^1.4.7", | ||
"flatnest": "^0.2.2", | ||
"gulp-util": "^3.0.4", | ||
"merge": "^1.2.0", | ||
"through2": "^0.6.3" | ||
} | ||
"through2": "^2.0.0" | ||
}, | ||
"files": [ | ||
"index.js", | ||
"Readme.md" | ||
] | ||
} |
@@ -59,3 +59,7 @@ [![NPM version][npm-img]][npm-url] | ||
"name": "haoxin", | ||
"age": 12345 | ||
"age": 12345, | ||
"socials": { | ||
"fb": "facebook.com/include", | ||
"tw": "twitter.com/include" | ||
} | ||
}) | ||
@@ -75,2 +79,4 @@ </body> | ||
<label>@@age</label> | ||
<strong>@@socials.fb</strong> | ||
<strong>@@socials.tw</strong> | ||
``` | ||
@@ -101,2 +107,4 @@ | ||
<label>12345</label> | ||
<strong>facebook.com/include</strong> | ||
<strong>twitter.com/include</strong> | ||
</body> | ||
@@ -153,3 +161,3 @@ </html> | ||
```html | ||
``` | ||
@@include('some.html', { "nav": true }) | ||
@@ -156,0 +164,0 @@ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
179
1
2
10272
5
3
142
+ Addedflatnest@^0.2.2
+ Addedflatnest@0.2.2(transitive)
- Removedreadable-stream@1.0.34(transitive)
- Removedthrough2@0.6.5(transitive)
Updatedthrough2@^2.0.0