Before posting this question, I took the trouble to Google this issue, but found that clearly I'm in the (extreme) minority so I'm obviously missing something. I've tried on more than one occassion to incorporate the asset-pipeline Grails plugin into my projects, but each time I find myself reverting to the resources plugin. Bottom line: I find the resource plugin far more intuitive and expressive than the 'anything goes' asset-pipeline, despite the underlying bells and whistles offered by the asset-pipeline plugin.
Probably the most confusing thing to me, is the way that resources are declared in either. In the resources plugin for example, I can define the fancybox resources as follows:
'fancybox' {
dependsOn 'jquery'
resource url: '/js/fancybox/jquery.fancybox.css'
resource url: '/js/fancybox/helpers/jquery.fancybox-buttons.css', attrs: [v: '2.1.5']
resource url: '/js/fancybox/jquery.fancybox.js', attrs: [v: '2.1.5']
resource url: '/js/fancybox/helpers/jquery.fancybox-buttons.js', attrs: [v: '2.1.5']
resource url: '/js/fancybox/helpers/jquery.fancybox-media.js', attrs: [v: '2.1.5']
}
There. Simple. That's the fancybox 'package' and it depends on jquery.
For asset pipeline however, I have to declare some weird non-standard convention as follows:
/*
*= require jquery.fancybox
*= require jquery.fancybox-buttons
*/
Then I'll need to refer to that file somewhere in application.css, and as if by magic, asset-pipeline will magically combine them for me with some convoluted logic that I have to keep looking up in the documentation to remind myself ( I don't even know if the above is correct, because I can never get asset-pipeline to work for me). However all my declarations are broken up across multiple .css files, rather than one nice all-in-one location like ApplicationResources.groovy, and I've got no idea what other plugins are declaring other assets unbeknownst to me, whereas with resources plugin, if it isn't in ApplicationResources.groovy, it doesn't exist.
Yet, as I say, I find no articles preferring resources plugin. Everybody appears to have 'drunk the Kool-Aid' on the asset-pipeline. What are the magic pro's that I'm clearly missing? It seems far more convoluted and confusing. What gives?
ApplicationResources.groovy
syntax, you are just used to what you currently know; that doesn't make it weird. - tylerwal