grunt-usemin
Advanced tools
Comparing version 2.3.0 to 2.4.0
@@ -61,2 +61,14 @@ 'use strict'; | ||
'Update the HTML with the new img filenames in meta tags' | ||
], | ||
[ | ||
/<object[^\>]+data=['"]([^"']+)["']/gm, | ||
'Update the HTML with the new object filenames' | ||
], | ||
[ | ||
/<image[^\>]*[^\>\S]+xlink:href=['"]([^"']+)["']/gm, | ||
'Update the HTML with the new image filenames for svg xlink:href links' | ||
], | ||
[ | ||
/<image[^\>]*[^\>\S]+src=['"]([^"']+)["']/gm, | ||
'Update the HTML with the new image filenames for src links' | ||
] | ||
@@ -69,2 +81,8 @@ ], | ||
] | ||
], | ||
json: [ | ||
[ | ||
/:\s*['"]([^"']+)["']/gm, | ||
'Update the json value to reference our revved url' | ||
] | ||
] | ||
@@ -71,0 +89,0 @@ }; |
@@ -28,2 +28,3 @@ 'use strict'; | ||
var dirname = path.dirname(file); | ||
var filepath = dirname === '.' ? '' : dirname + '/'; | ||
var candidates = []; | ||
@@ -43,3 +44,3 @@ var self = this; | ||
var cfile = path.basename(self.mapping[key]); | ||
candidates.push(dirname + '/' + cfile); | ||
candidates.push(filepath + cfile); | ||
debug('Found a candidate: %s/%s', dirname, cfile); | ||
@@ -46,0 +47,0 @@ } |
{ | ||
"name": "grunt-usemin", | ||
"version": "2.3.0", | ||
"license": "BSD", | ||
"version": "2.4.0", | ||
"license": "BSD-2-Clause", | ||
"author": "The Yeoman Team", | ||
@@ -27,12 +27,12 @@ "description": "Replaces references to non-optimized scripts or stylesheets into a set of HTML files (or any templates/views).", | ||
"dependencies": { | ||
"debug": "~1.0.1", | ||
"debug": "~1.0.4", | ||
"lodash": "~2.4.1" | ||
}, | ||
"devDependencies": { | ||
"grunt": "~0.4.4", | ||
"grunt": "~0.4.5", | ||
"grunt-contrib-jshint": "~0.10.0", | ||
"grunt-jscs-checker": "~0.6.0", | ||
"grunt-mocha-cli": "~1.9.0", | ||
"grunt-jscs": "~0.6.2", | ||
"grunt-mocha-cli": "~1.10.0", | ||
"mkdirp": "~0.5.0", | ||
"rimraf": "~2.2.7" | ||
"rimraf": "~2.2.8" | ||
}, | ||
@@ -39,0 +39,0 @@ "peerDependencies": { |
# grunt-usemin [![Build Status](https://secure.travis-ci.org/yeoman/grunt-usemin.svg?branch=master)](http://travis-ci.org/yeoman/grunt-usemin) | ||
> Replaces references to non-optimized scripts or stylesheets into a set of HTML files (or any templates/views). | ||
> Replaces references from non-optimized scripts, stylesheets and other assets to their optimized version within a set of HTML files (or any templates/views). | ||
Watch out, this task is designed for Grunt 0.4 and upwards. | ||
**[Maintainer wanted](https://github.com/yeoman/grunt-usemin/issues/313)** | ||
## Getting Started | ||
@@ -19,11 +20,18 @@ If you haven't used [grunt][] before, be sure to check out the [Getting Started][] guide, as it explains how to create a [gruntfile][Getting Started] as well as install and use grunt plugins. Once you're familiar with that process, install this plugin with this command: | ||
`usemin` exports 2 different tasks: | ||
* `useminPrepare` prepares the configuration to transform specific construction (blocks) in the scrutinized file into a single line, targeting an optimized version of the files (e.g concatenated, uglifyjs-ed ...) | ||
`usemin` replaces the references of scripts, stylesheets and other assets within HTML files dynamically with optimized versions of them. To do this `usemin` exports 2 built-in tasks called `useminPrepare` and `usemin` and utilizes a couple of other Grunt plugins for the optimization process. `usemin` does this by generating the subtasks for these Grunt plugins dynamically. | ||
The built-in tasks of `usemin`: | ||
* `useminPrepare` prepares the configuration to transform specific blocks in the scrutinized file into a single line, targeting an optimized version of the files. This is done by generating subtasks called `generated` for every optimization steps handled by the Grunt plugins listed below. | ||
* `usemin` replaces the blocks by the file they reference, and replaces all references to assets by their revisioned version if it is found on the disk. This target modifies the files it is working on. | ||
In addition, `useminPrepare` dynamically generates the configuration for `concat`, `uglify`, and `cssmin`. | ||
**Important**: _you still need to manually manage these dependencies and call each task_. | ||
Grunt plugins which `usemin` can use to optimize files: | ||
* [`concat`](https://github.com/gruntjs/grunt-contrib-concat) concatenates files (usually JS or CSS). | ||
* [`uglify`](https://github.com/gruntjs/grunt-contrib-uglify) minifies JS files. | ||
* [`cssmin`](https://github.com/gruntjs/grunt-contrib-cssmin) minifies CSS files. | ||
* [`filerev`](https://github.com/yeoman/grunt-filerev) revisions static assets through a file content hash. | ||
Usually, `useminPrepare` is launched first, then the steps of the transformation flow (e.g. `concat`, `uglify`, and `cssmin`), and then, in the end `usemin` is launched. For example: | ||
**Important**: _You still need to manually install and load these dependencies_. | ||
In a typical `usemin` setup you launch `useminPrepare` first, then call every optimization step you want through their `generated` subtask and call `usemin` in the end. It could look like this: | ||
```js | ||
@@ -33,5 +41,5 @@ // simple build task | ||
'useminPrepare', | ||
'concat', | ||
'cssmin', | ||
'uglify', | ||
'concat:generated', | ||
'cssmin:generated', | ||
'uglify:generated', | ||
'filerev', | ||
@@ -94,11 +102,25 @@ 'usemin' | ||
concat: { | ||
'.tmp/concat/js/app.js': [ | ||
'app/js/app.js', | ||
'app/js/controllers/thing-controller.js', | ||
'app/js/models/thing-model.js', | ||
'app/js/views/thing-view.js' | ||
] | ||
generated: { | ||
files: [ | ||
{ | ||
dest: '.tmp/concat/js/app.js', | ||
src: [ | ||
'app/js/app.js', | ||
'app/js/controllers/thing-controller.js', | ||
'app/js/models/thing-model.js', | ||
'app/js/views/thing-view.js' | ||
] | ||
} | ||
] | ||
} | ||
}, | ||
uglifyjs: { | ||
'dist/js/app.js': ['.tmp/concat/js/app.js'] | ||
uglify: { | ||
generated: { | ||
files: [ | ||
{ | ||
dest: 'dist/js/app.js', | ||
src: [ '.tmp/concat/js/app.js' ] | ||
} | ||
] | ||
} | ||
} | ||
@@ -105,0 +127,0 @@ } |
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
Misc. License Issues
License(Experimental) A package's licensing information has fine-grained problems.
Found 1 instance in 1 package
57929
0
1096
593
Updateddebug@~1.0.4