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

gulp-usemin

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-usemin - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

test/fixtures/simple-css-alternate-path.html

15

index.js

@@ -17,7 +17,7 @@ var path = require('path');

var startReg = /<!--\s*build:(css|js)\s+(\/?([^\s]+))\s*-->/gim;
var startReg = /<!--\s*build:(css|js)(?:\(([^\)]+)\))?\s+(\/?([^\s]+))\s*-->/gim;
var endReg = /<!--\s*endbuild\s*-->/gim;
var jsReg = /<\s*script\s+.*src\s*=\s*"([^"]+)".*><\s*\/\s*script\s*>/gi;
var cssReg = /<\s*link\s+.*href\s*=\s*"([^"]+)".*>/gi;
var mainPath, mainName;
var mainPath, mainName, alternatePath;

@@ -38,3 +38,3 @@ function createFile(name, content) {

.replace(reg, function (a, b) {
paths.push(path.join(mainPath, b));
paths.push(path.join(alternatePath || mainPath, b));
});

@@ -74,2 +74,3 @@

var section = sections[i].split(startReg);
alternatePath = section[2];

@@ -79,8 +80,8 @@ html.push(section[0]);

if (section[1] == 'js') {
html.push('<script src="' + section[2] + '"></script>');
files.push(processJs(section[4], section[3]));
html.push('<script src="' + section[3] + '"></script>');
files.push(processJs(section[5], section[4]));
}
else {
html.push('<link rel="stylesheet" href="' + section[2] + '"/>');
files.push(processCss(section[4], section[3]));
html.push('<link rel="stylesheet" href="' + section[3] + '"/>');
files.push(processCss(section[5], section[4]));
}

@@ -87,0 +88,0 @@ }

{
"name": "gulp-usemin",
"version": "0.1.3",
"version": "0.1.4",
"description": "Replaces references to non-optimized scripts or stylesheets into a set of HTML files (or any templates/views).",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -36,3 +36,3 @@ # gulp-usemin

```html
<!-- build:<type> <path> -->
<!-- build:<type>(alternate search path) <path> -->
... HTML Markup, list of script / link tags.

@@ -43,2 +43,3 @@ <!-- endbuild -->

- **type**: either `js` or `css`
- **alternate search path**: (optional) By default the input files are relative to the treated file. Alternate search path allows one to change that
- **path**: the file path of the optimized file, the target output

@@ -45,0 +46,0 @@

@@ -211,2 +211,22 @@ /* jshint node: true */

});
it('simple with alternate path (css block)', function(done) {
var name = 'data/css/style.css';
var expectedName = 'data/css/min-style.css';
var exist = false;
compare(
'simple-css-alternate-path.html',
function(newFile) {
if (newFile.path === name) {
exist = true;
assert.equal(String(getExpected(expectedName).contents), String(newFile.contents));
}
},
function() {
assert.ok(exist);
done();
}
);
});
});

@@ -264,2 +284,21 @@

});
it('simple with alternate path (css block)', function(done) {
var expectedName = 'data/css/style.css';
var exist = false;
compare(
'simple-css-alternate-path.html',
function(newFile) {
if (newFile.path === expectedName) {
exist = true;
assert.equal(String(getExpected(expectedName).contents), String(newFile.contents));
}
},
function() {
assert.ok(exist);
done();
}
);
});
});

@@ -317,2 +356,22 @@

});
it('simple with alternate path (js block)', function(done) {
var name = 'data/js/app.js';
var expectedName = 'data/js/min-app.js';
var exist = false;
compare(
'simple-js-alternate-path.html',
function(newFile) {
if (newFile.path === name) {
exist = true;
assert.equal(String(getExpected(expectedName).contents), String(newFile.contents));
}
},
function() {
assert.ok(exist);
done();
}
);
});
});

@@ -370,4 +429,23 @@

});
it('simple with alternate path (js block)', function(done) {
var expectedName = 'data/js/app.js';
var exist = false;
compare(
'simple-js-alternate-path.html',
function(newFile) {
if (newFile.path === expectedName) {
exist = true;
assert.equal(String(getExpected(expectedName).contents), String(newFile.contents));
}
},
function() {
assert.ok(exist);
done();
}
);
});
});
});
});

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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