0

I'm close to giving up here -- there's roughly 5 different repositories with different versions of handlebars-asset-pipeline with different instructions, and I can't get any of them to work.

I'm using Grails 3.1.1 with the default build.gradle created by init-app, added handlebars-asset-pipeline 2.7 to both the buildscript and normal dependencies, and put a foo.hbs file into grails-app/assets.

Now, when running gradlew compileAssets, the templates get compiled correctly, so the plugin is doing something, but I was expecting it to also work when running the application via grails run-app. Is it wrong of me to expect that? If not, can someone be so kind as to give me a working example of how to integrate the template precompiler?

gschmidl
  • 105
  • 2
  • 6

2 Answers2

1

I find specifying assets instead of runtime is the thing that trips me up. I can get it to work adding the following

buildscript {
  ...
  dependencies {
     ...
     classpath "com.bertramlabs.plugins:asset-pipeline-gradle:2.14.6"
  }
}

apply plugin: 'com.bertramlabs.asset-pipeline'


runtime "com.bertramlabs.plugins:asset-pipeline-grails:2.14.3"
assets 'com.bertramlabs.plugins:handlebars-asset-pipeline:2.14.6'
0

I don't use it but since you use Gradle I'm quite sure you can add it as your own task with dependsOn: 'compileAssets'. Check out example for Android.

Community
  • 1
  • 1
Michal_Szulc
  • 4,097
  • 6
  • 32
  • 59
  • True, but that puts the compiled assets into the build/ folder as opposed to compiling them on-the-fly, which is what I'd expect the plugin to do (but that might be my mistaken assumption). – gschmidl Mar 09 '16 at 11:29