Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gulp-assign

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-assign - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2

examples/gulpfile.js

14

index.js

@@ -17,2 +17,3 @@ 'use strict';

pathIsAbsolute = path.isAbsolute,
isString = is.string,
isFunction = is.function,

@@ -23,4 +24,4 @@ isPlainObject = is.plainObject,

SPLITS = /<!--\s*build:(?:styles|scripts)(?::[\w-]*)?\s*(?:\s+\S+?|"[^"]+"|'[^']+')\s*-->[^]*?<!--\s*endbuild\s*-->/,
BLOCKS = /<!--\s*build:(styles|scripts)(?::([\w-]*))?\s*(\s+\S+?|"[^"]+"|'[^']+')\s*-->([^]*?)<!--\s*endbuild\s*-->/g,
SPLITS = /<!--\s*build:(?:styles|scripts|css|js|style|script)(?::[\w-]*)?\s*(?:\s+\S+?|"[^"]+"|'[^']+')\s*-->[^]*?<!--\s*endbuild\s*-->/,
BLOCKS = /<!--\s*build:(styles|scripts|css|js|style|script)(?::([\w-]*))?\s*(\s+\S+?|"[^"]+"|'[^']+')\s*-->([^]*?)<!--\s*endbuild\s*-->/g,
INPUTS = {

@@ -123,2 +124,11 @@ styles: /<\s*link\b[^>]*\bhref\s*=\s*("[^"]+"|'[^']+'|[^\s>]+)[^>]*>/gi,

if (!output) {
output = outputOriginal;
} else if (isPlainObject(output)) {
output = ouput.original;
}
if (!output || !isString(output)) {
return callback(new PluginError(PLUGIN_NAME, 'Invalid output path'));
}
output = OUTPUTS[type].replace('${output}', output);

@@ -125,0 +135,0 @@ finish(

'use strict';
module.exports = {
string: function(x) {
return typeof x === 'string';
},
function: function(x) {

@@ -5,0 +8,0 @@ return typeof x === 'function';

6

package.json
{
"name": "gulp-assign",
"version": "0.2.1",
"version": "0.2.2",
"main": "index.js",

@@ -15,5 +15,7 @@ "dependencies": {

"mocha": "^2.3.4",
"run-sequence": "^1.1.5",
"sinon": "^1.17.2"
},
"scripts": {
"start": "gulp --gulpfile examples/gulpfile.js",
"test": "mocha tests"

@@ -34,3 +36,3 @@ },

"author": "",
"description": "Detects JavaScript/CSS references in HTML and passes to others plugins"
"description": "Detects JavaScript/CSS references in HTML and passes/assigns to others plugins"
}

@@ -17,4 +17,11 @@ 'use strict';

var type = block[1],
inputs = splitInputs(block[4], INPUTS[type]).map(function(input) {
var type = block[1];
if (type === 'css' || type === 'style') {
type = 'styles';
} else if (type === 'js' || type === 'script') {
type = 'scripts';
}
var inputs = splitInputs(block[4], INPUTS[type]).map(function(input) {
return parseInputs(input, DIRECTORY);

@@ -21,0 +28,0 @@ });

@@ -11,15 +11,32 @@ # gulp-assign

```
└── src/
├── css/
│ ├── lib/
│ │ ├── a.css
│ │ └── b.css
│ ├── a.css
│ └── b.css
├── js/
│ ├── lib/
│ │ ├── a.js
│ │ └── b.js
│ ├── a.js
│ └── b.js
└── index.html
```
```html
<!-- build:styles /css/main.css -->
<link rel="stylesheet" href="css/aaa.css" />
<link rel="stylesheet" href="css/bbb.css" />
<!-- build:css /css/main.css -->
<link rel="stylesheet" href="css/a.css" />
<link rel="stylesheet" href="css/b.css" />
<!-- endbuild -->
<!-- build:scripts:vendor /js/lib/main.js -->
<script src="js/lib/aaa.js"></script>
<script src="js/lib/bbb.js"></script>
<!-- build:js:lib ./js/main.lib.js -->
<script src="js/lib/a.js"></script>
<script src="js/lib/b.js"></script>
<!-- endbuild -->
<!-- build:scripts /js/main.js -->
<script src="js/aaa.js"></script>
<script src="js/bbb.js"></script>
<!-- build:js ./js/main.js -->
<script src="js/a.js"></script>
<script src="js/b.js"></script>
<!-- endbuild -->

@@ -42,5 +59,3 @@ ```

.on('error', callback)
.on('end', function() {
callback(null, output.original);
});
.on('end', callback);
};

@@ -52,7 +67,7 @@

default: streamAssignee,
vendor: callbackAssignee
lib: callbackAssignee
}
};
gulp.task('optimize', function() {
gulp.task('pack', function() {
return gulp.src('src/**/*.html')

@@ -63,1 +78,20 @@ .pipe(assign(assignees))

```
### Results
```
└── dist/
├── css/
│ └── main.css
├── js/
│ ├── main.js
│ └── main.lib.js
└── index.html
```
```html
<link rel="stylesheet" href="/css/main.css" />
<script src="./js/main.lib.js"></script>
<script src="./js/main.js"></script>
```

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc