bertramdev / asset-pipeline

The core implementation of the asset pipeline for the jvm
194 stars 92 forks source link

Grails 3.3.4 integration test not compiling SCSS #204

Closed mtgleeson closed 4 years ago

mtgleeson commented 6 years ago

Hi I've recently upgrade from Grails 3.2.4 to 3.3.4. After upgrading, when I run my integration tests the scss files are not compiled (grails test-app -integration). Previously on Grails 3.2.4 they would be compiled as expected.

When I run the application they compile fine (grails run-app), it works fine with building the war (grails war).

Is there something that needs to be configured differently for SCSS to compile on grails 3.3.4 for the integration tests?

mtgleeson commented 6 years ago

Figured it out. The scss file wasn't being compiled because the SassAssetFile wasn't loaded into the class loader and so the AssetSpecLoader.loadSpecifications wasn't loading 'scss' as an extension type for 'text/css' and returning is as a specification (during DirectiveProcessor.requireFileDirective).

Solution: in build.gradle, in addition to assets 'com.bertramlabs.plugins:sass-asset-pipeline:2.14.9' I need to add: testCompile "com.bertramlabs.plugins:sass-asset-pipeline:2.14.9"

My scss is now being compiled for integration tests.

andersaaberg commented 6 years ago

Big thank you for your solution - I had the same problem with less-asset-pipeline and your solution worked much better than my hacks.

It would be very helpful to get it into the documentation - I suggest that this is added the following places:

  1. https://github.com/bertramdev/asset-pipeline/README.md (the Documentation section regarding "For Grails 3 asset-pipeline has to be provided both for Grails and Gradle. An example configuration could be: [...]")
  2. http://www.asset-pipeline.com/manual/index.html#grails3
azuledu commented 3 years ago

Still not in documentation.