Kirby
Kirby

Reputation: 2008

Grails 3 - Angular template asset pipeline not bundling converted js files into application.js

I'm using Grails 3.1.10, angular-template-asset-pipeline 2.2.6, and asset-pipeline-gradle 2.8.2

It's tough for me to share config files as I work behind a firewall but the general issue is mostly similar to this https://github.com/bertramdev/grails-asset-pipeline/issues/336 (discussion started so i'll have to update question as things go)

Everything works fine under 'grails run-app' but when i run 'grails war':

  1. the templates get correctly converted to js files
  2. are exploded in tomcat under /webapps/myApp/assets
  3. are not present in the application.js bundled result, therefore my app cannot find any html.

Any help appreciated.

I was required to put assets stuff in my application.groovy development environment for run-app to work, but i'm not sure if application.groovy is used when running 'grails war' .. i'm not a fan of having duplicate asset pipeline configurations. (build.gradle as well as application.groovy for each environment)

Thanks!

Upvotes: 1

Views: 191

Answers (1)

Kirby
Kirby

Reputation: 2008

After i figured out which config file the configuraitons where coming from (run-app -> application.groovy, grails war -> build.gradle) ... i figured it out.

I got it to work with the following steps...

  1. I moved all my templateUrl: 'file.html' calls to templateUrl: '/myApp/file.html' (directives and view code)
  2. i set my "includePathInName= true"
  3. i put my .tpl.html files in grails-app/assets/javascripts/myApp/templates

Important takeaway here is that grails-app/assets/javascripts/templates would not work for me.

Upvotes: 0

Related Questions