Search code examples
grailsasset-pipelinegrails-plugin

How to package plugin assets with the new asset-pipeline plugin in binary mode?


Our projects depending on a grails plugin we call "dataLayer" because it holds our data across different applications. For example shared Domain classes, shared theme, css, javascripts.

This worked fine with the resources plugin. Now i migrated to the asset pipeline plugin and it works also fine locally in development environment with inplace-plugins.

Using the same application online in production doesn't work because the css files and js files are empty or missing.

Maybe good to know: Our DataLayer Plugin contains the default asset folders in grails-app/. There we have one additional folder, called "theme" containing all js and css for our theme. In the javascript and css folders we have some files wich declare files as requirement wich are in the theme folder. This works fine in development environment.

For example the core.js within dataLayer plugin in grails-app/assets/javascripts/core.js

//= require ../theme/assets/plugins/jquery-1.10.1.min
//= require ../theme/assets/plugins/jquery-migrate-1.2.1.min
// IMPORTANT! Load jquery-ui-1.10.1.custom.min.js before bootstrap.min.js to fix bootstrap tooltip conflict with jquery ui tooltip
//= require ../theme/assets/plugins/jquery-ui/jquery-ui-1.10.1.custom.min
//= require ../theme/assets/plugins/bootstrap/js/bootstrap.min
//= require ../theme/assets/plugins/jquery-slimscroll/jquery.slimscroll.min
//= require ../theme/assets/plugins/jquery.blockui.min
//= require ../theme/assets/plugins/jquery.cookie.min
//= require ../theme/assets/plugins/uniform/jquery.uniform.min
//= require ../theme/assets/scripts/app

Also good to know: We use binary plugin packaging, so the dataLayer Plugin gets packaged in binary mode (without sources) and uploaded to our maven repository. From there it gets resolved in production environment. ===> And i think here is the problem. I think that the assets folder doesn't get packaged into the jar.

Could this be possible? If yes, how could i add the assets folder into packaging correctly?

UPDATE: The problem only appears while using binary plugins without sources. Seems that the grails package (maven-deploy --binary) doesn't include the assets when using the following options:

In Plugin descriptor:

def packaging = "binary"

In BuildConfig.groovy:

grails.project.plugin.includeSource = false

bildschirmfoto 2014-05-27 um 11 07 43

The static images, javascripts, css from web-app folder are always in the target jar (regardless wich options i use), so this seems to be an asset pipeline problem.


Solution

  • Binary plugin mode isn't supported with the asset-pipeline plugin yet. David Estes, the developer of the plugin is working on it. You can find the issue for that here: https://github.com/bertramdev/asset-pipeline/issues/98