grunt-usemin
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -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); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
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
494
0
23085
11