From d7b65971ed54abd4f0330b5c63206d1f2c0555ff Mon Sep 17 00:00:00 2001 From: Johnny Liu Date: Sun, 3 Apr 2016 20:57:25 +1000 Subject: [PATCH 1/4] add info about finding references in usemin task There is no document for how does `usemin` find references in files. It is important to tell users about this so that we can write task correctly to ensure `usemin` replace references which we want to. --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index dc33285..ecfd714 100644 --- a/README.md +++ b/README.md @@ -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`. + ### 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. From 2b1836e4aa027532af62cad41078e04f9eaeb4eb Mon Sep 17 00:00:00 2001 From: Johnny Liu Date: Thu, 7 Apr 2016 19:39:22 +1000 Subject: [PATCH 2/4] change `url(` and `)` to `url(...)` --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ecfd714..1e97cb9 100644 --- a/README.md +++ b/README.md @@ -350,7 +350,7 @@ The `usemin` task has 2 actions: `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`. +For example, if the target name is `html`, `usemin` will find references of images, scripts, stylesheets, etc. However, `usemin` will only find references look like `url(...)` when target name is `css`. ### Finding assets From f348c3b72c177f3400dcabcdfa858f2d397ba222 Mon Sep 17 00:00:00 2001 From: Johnny Liu Date: Fri, 8 Apr 2016 08:22:41 +1000 Subject: [PATCH 3/4] add a example to make it easy to be understanded --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1e97cb9..6ac87f3 100644 --- a/README.md +++ b/README.md @@ -348,9 +348,11 @@ The `usemin` task has 2 actions: ### 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. +`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 images, scripts, stylesheets, etc. However, `usemin` will only find references look like `url(...)` when target name is `css`. +For example, if the target name is `html`, `usemin` will find references of ` Date: Sat, 9 Apr 2016 07:38:21 +1000 Subject: [PATCH 4/4] clean up some confusion --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6ac87f3..8179c48 100644 --- a/README.md +++ b/README.md @@ -351,7 +351,7 @@ The `usemin` task has 2 actions: `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 `