Skip to content
This repository has been archived by the owner on Apr 20, 2018. It is now read-only.

add info about finding references in usemin task #619

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,12 @@ The `usemin` task has 2 actions:
* First it replaces all the blocks with a single "summary" line, pointing to a file creating by the transformation flow.
* Then it looks for references to assets (i.e. images, scripts, ...), and tries to replace them with their revved version if it can find one on disk

### Finding references

`usemin` will look for different kinds of references in files of certain types. The type of the file should be indicated by using target name. That is to say, the target name in the `usemin` task should only be in `html`, `css`, `json` and `svg` so that `usemin` can find possible types of references in these files.

For example, if the target name is `html`, `usemin` will find references of images, scripts, stylesheets, etc. However, `usemin` will only find references which are surrounded by `url(` and `)` when target name is `css`.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest we use url(...) instead of url( and ) as the placeholder.


### Finding assets

By default `usemin` will look for a map object created by [grunt-filerev](https://github.com/yeoman/grunt-filerev), located in `grunt.filerev.summary`. If it does not find it it will revert to disk lookup which is longer.
Expand Down