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

grunt-usemin

Package Overview
Dependencies
Maintainers
4
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-usemin - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

22

lib/htmlprocessor.js

@@ -24,3 +24,3 @@ 'use strict';

// Note that when treating an HTML file making usage of requireJS
// and additional information for the block is added, regarding RequireJS
// an additional information for the block is added, regarding RequireJS
// configuration. For example:

@@ -52,2 +52,3 @@ //

var endbuild = regend.test(l);
var startFromRoot = false;

@@ -59,2 +60,3 @@ // discard empty lines

if (build[2][0] === '/') {
startFromRoot = true;
build[2] = build[2].substr(1);

@@ -65,2 +67,3 @@ }

dest: path.join(dir, build[2]),
startFromRoot: startFromRoot,
indent: indent,

@@ -82,3 +85,3 @@ src: [],

if (asset && asset[2]) {
last.src.push(path.join(dir,asset[2]));
last.src.push(path.join(dir, asset[2]));
// RequireJS uses a data-main attribute on the script tag to tell it

@@ -94,3 +97,4 @@ // to load up the main entry point of the amp app

last.requirejs.dest = last.dest;
last.requirejs.name = path.join(dir, main[1]);
last.requirejs.baseUrl = path.join(dir, path.dirname(main[1]));
last.requirejs.name = path.basename(main[1]);
last.src.push(last.dest);

@@ -116,3 +120,3 @@ }

this.filepath = filepath;
this.relativePath = path.relative( process.cwd(), path.dirname(filepath));
this.relativePath = path.relative(process.cwd(), path.dirname(filepath));
this.content = content;

@@ -140,9 +144,13 @@ this.revvedfinder = revvedfinder;

// file
var dest = path.relative(this.relativePath, block.dest);
var dest = path.relative(this.relativePath, block.dest);
if (block.startFromRoot) {
dest = '/' + dest;
}
// fix windows style paths. Dirty but works.
var dest = dest.replace('\\', '/');
dest = dest.replace('\\', '/');
if (block.type === 'css') {
result = block.indent + '<link rel="stylesheet" href="' + dest + '"\/>';
result = block.indent + '<link rel="stylesheet" href="' + dest + '">';
} else if (block.type === 'js') {

@@ -149,0 +157,0 @@ result = block.indent + '<script src="' + dest + '"><\/script>';

@@ -61,5 +61,6 @@ 'use strict';

// a images/misc/4567.test.png for example)
var filepaths = this.expandfn(path.join('**/*') + basename);
var filepaths = this.expandfn('**/*' + basename);
var re = new RegExp('\\d+\\.' + basename + '$');
var filepath = filepaths.filter(function (f) {
return normalizedDirname === path.dirname(f);
return f.match(re) && (normalizedDirname === path.dirname(f));
})[0];

@@ -66,0 +67,0 @@

{
"name": "grunt-usemin",
"version": "0.1.1",
"version": "0.1.2",
"description": "Grunt task replaces references to non-optimized scripts or stylesheets into a set of HTML files (or any templates/views).",

@@ -28,3 +28,3 @@ "keywords": [

"rimraf": "~2.0.1",
"grunt-contrib-jshint": "~0.1.0"
"grunt-contrib-jshint": "~0.1.1"
},

@@ -31,0 +31,0 @@ "engines": {

@@ -108,3 +108,3 @@ 'use strict';

// collect files
var files = grunt.file.expandFiles(this.data);
var files = grunt.file.expand({filter: 'isFile'}, this.data);

@@ -148,2 +148,3 @@ // concat / min / css / requirejs config

requirejs.out = requirejs.out || block.requirejs.dest;
requirejs.baseUrl = requirejs.baseUrl || block.requirejs.baseUrl;
requirejs.name = requirejs.name || block.requirejs.name;

@@ -150,0 +151,0 @@ grunt.config('requirejs', requirejs);

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