Casey
Casey

Reputation: 23

Grails Asset-Pipeline - Bundling of assets in WAR

I'm trying to use the asset-pipeline that's now part of Grails 2.4, and I don't quite understand how it's bundling my assets directory. I'm also using bower and have bower_components under ./assets/

I have application.js and application.css manifest 'require'ing the necessary assets. When I run a 'grails war', it minifies and gzips every single asset under bower_components and includes them in the .war.

The final, minified application.js and application.css in the .war looks great, but I'm not clear why it's also including every single asset, all of which won't be requested at all in the deployed app thanks to application.js/css.

Should I be explicitly excluding these (all the assets that aren't in my manifest) using "grails.assets.excludes"? Or, is it common to leave them bundled in the .war and not worry about it since it's not being referenced and not hurting anything?

Upvotes: 2

Views: 931

Answers (1)

davydotcom
davydotcom

Reputation: 2210

Great question. The answer is actually both. You can leave them in your war file and not worry about them but this does add unnecessary weight. Once you are satisfied with your manifests and bundles you can configure your exclude patterns to omit files you don't need using GLOB wildcard patterns (don't have to exclude each file individually). You can also exclude all then use the includes config to whitelist items. We do this so you don't get any unexpected surprises by finding out your missing certain files in production. Allowing you to make these omissions when you see fit in your release cycle.

Upvotes: 1

Related Questions