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 3 commits
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
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,14 @@ 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, any target name in the `usemin` task should only be in `html`, `css`, `json` and `svg` so that `usemin` can lookup possible types of references in these files of a certain type.

For example, if the target name is `html`, `usemin` will find references of `<img src="..."`, `<script src="..."`, `<link href="..."`, etc.
However, `usemin` will only find references look like `url(...)` 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.

"However, usemin will only find references which look like url(...) when target name is css."

Quick edit.

For some other target names, such as `scripts`, `assets`, `usemin` will do nothing.

### 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