Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add feature for deduplicating javascript and stylesheets (#205)
* Add a uniq parameter to the asset gsp tags The idea is that if you have a page that is composed of a bunch of modules, you may want each module to declare it's own asset dependencies. Often times these dependencies will contain a bunch of overlapping requirements of common libraries and such, which should not be included multiple times. If the uniq parameter is supplied, keep track of which assets have been included into the page, or more specifically in the request, and skip writing out duplicate entries. This approach is completely incompatible with resource bundling, since the bundler can't know where the overlaps are. * Ensure that assets are tracked uniformly When using the memo for tracking which assets have been included so far we need to make sure that we're always using the same name for each asset so do that post resolve. * Track already written assets by both name and extension Not sure why I thought it was a good idea to track the already included assets by just name but we need to include the extension as well since you might have, e.g. js and css files with the same basename. * Don't write out bundled assets in war deployment Avoid using the asset manifest when either uniq mode, or bundling is disabled. The asset manifest, if it exists, will point to the pre-bundled assets, which ultimately defeat the purpose of those config options. Also add a global config option to do the same, defaulting to off of course. * Missed a call site of the output closure
- Loading branch information
1 parent
54ab669
commit f8bd3d7
Showing
6 changed files
with
112 additions
and
40 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
...-pipeline-grails/grails-app/assets/javascripts/asset-pipeline/test/test_simple_require.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
//=require libs/file_a | ||
|
||
console.log("This and file_a should be included"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters