Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Asset Pipeline Gradle in plugin breaks consuming web #60

Closed
ctoestreich opened this issue Dec 7, 2015 · 16 comments
Closed

Asset Pipeline Gradle in plugin breaks consuming web #60

ctoestreich opened this issue Dec 7, 2015 · 16 comments
Labels

Comments

@ctoestreich
Copy link

When a plugin defines the asset-pipeline-gradle build dep, plugin apply and an asset closure inside it's build config - a consuming web application breaks when trying to load local assets (less, css, js). The tag renders with <script... application.js> but without the ?compile=false and asking for the resource directly produces a 404.

In the example below the foo.css asset from the plugin is rendered and the background is green, but the parents level assets of application.js and application.css are not processed. I have tried including the excluding the asset-pipeline-gradle from the web project to no avail. It isn't until the plugin project removes the asset-pipeline-gradle reference that everything works.

Example of the issue using grails 3.0.9 and asset-pipeline 2.6.9.

https://github.com/Grails-Plugin-Consortium/asset-pipeline-bug

Cheers.

@davydotcom
Copy link
Contributor

A plugin should not use asset pipeline gradle as a build dependency as assets are not processed until app phase

Sent from my iPhone

On Dec 7, 2015, at 6:37 PM, Christian Oestreich notifications@github.com wrote:

When a plugin defines the asset-pipeline-gradle build dep, plugin apply and an asset closure inside it's build config - a consuming web application breaks when trying to load local assets (less, css, js). The tag renders with but without the ?compile=false and asking for the resource directly produces a 404.

In the example below the foo.css asset from the plugin is rendered and the background is green, but the parents level assets of application.js and application.css are not processed. I have tried including the excluding the asset-pipeline-gradle from the web project to no avail. It isn't until the plugin project removes the asset-pipeline-gradle reference that everything works.

Example of the issue using grails 3.0.9 and asset-pipeline 2.6.9.

https://github.com/Grails-Plugin-Consortium/asset-pipeline-bug

Cheers.


Reply to this email directly or view it on GitHub.

@ctoestreich
Copy link
Author

I get that but we have a situation where we have plugins that we run as web apps, such as our pattern library, which need both standalone and plugin capabilities. We could split them, but it works great in grails 2.x today.

@ctoestreich
Copy link
Author

We have several nested infrastructures such as:

domain -> pattern-libray -> web -> app

where domain, pattern library and web are all plugins and the app is the only actual app. We work mainly in web due to it containing shared web functionality. The app only has some small tweaks as there are 16 different app artifacts.

Having web run stand alone is important, as is using local plugin references from all the layers (for example). This allows us to change core stuff and see it quickly in the brands without having to solve version/snapshot hell.

@ctoestreich
Copy link
Author

@davydotcom Another question - Is there any reason that the configuration for the plugin is in the build.gradle and not the application.yaml file?

The above situation where a plugin can not define the asset-pipeline-gradle can not set properties like es5->es6 level support, minify and compile options, etc.

@davydotcom
Copy link
Contributor

The reason is gradle cannot interpret application.yml. Thats grails runtime config where as assets{} is gradle build config

@davydotcom
Copy link
Contributor

The reason your app doesn't work when you use that plugin is you've loaded a assets/manifest.properties onto the class path of the project which makes your web app assume its packaged. You need to make sure when packaging a plugin for use by a webapp that assetCompile task is not used. If you want to make a jar for a plugin runtime you can adjust that task to use assetCompile

@kevana
Copy link

kevana commented Dec 14, 2015

If we can't use asset pipeline gradle in plugins is there another way to specify extra build-time includes? We have a plugin that provides font files in grails-app/assets/fonts and it looks like that directory isn't being included in the plugin jar. The examples I've seen for adding extra directories have used assets { includes = ["fonts/*"] } in build.gradle.

Plugin structure:

app
- web
- - pattern-library (has grails-app/assets/fonts)
- - domain

We can get around this by moving fonts under one of the default folders (images, javascripts, stylesheets), but it's not ideal.

@davydotcom
Copy link
Contributor

this is actually a bug in the grails gradle plugin that has since been fixed are you on the latest grails3 build?

@kevana
Copy link

kevana commented Dec 14, 2015

The project is on 3.0.9, was it fixed in .10 or do we need 3.1.0.M3?

@davydotcom
Copy link
Contributor

I would try 10 for sure

Sent from my iPhone

On Dec 14, 2015, at 2:05 PM, Kevan Ahlquist notifications@github.com wrote:

The project is on 3.0.9, was it fixed in .10 or do we need 3.1.0.M3?


Reply to this email directly or view it on GitHub.

@kevana
Copy link

kevana commented Dec 14, 2015

Still seeing this error with 3.0.10 as soon as we add classpath "com.bertramlabs.plugins:asset-pipeline-gradle:2.6.9" to the dependencies block and refresh the gradle project:

Error:(26, 0) Cannot cast object 'org.jfrog.gradle.plugin.artifactory.dsl.ArtifactoryPluginConvention@3539c456' with class 'org.jfrog.gradle.plugin.artifactory.dsl.ArtifactoryPluginConvention' to class 'org.jfrog.gradle.plugin.artifactory.dsl.ArtifactoryPluginConvention'

We also use the artifactory plugin

id "com.jfrog.artifactory" version "3.1.1"

edit: 3.2.0 of the artifactory plugin hits the same error. We tried excluding org.jfrog.gradle a few different ways but didn't have any luck. Anyone know if we're on the right track?

@davydotcom
Copy link
Contributor

what gradle version?

@kevana
Copy link

kevana commented Dec 14, 2015

2.9

@davydotcom
Copy link
Contributor

sure this isn't an artifactory plugin issue? asset-pipeline-gradle does not even reference this plugin

@kevana
Copy link

kevana commented Dec 14, 2015

We're guessing the Bintray and Artifactory plugins aren't getting along but haven't tracked down the root cause yet. For now we moved our fonts under the stylesheets directory. Thanks for the help

@davydotcom
Copy link
Contributor

fixed plugin support , added asset-pipeline-gradle to your grails 3 plugin...

apply plugin: 'asset-pipeline'
assets {
  packagePlugin = true
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants