Skip to content

Commit

Permalink
Merge pull request #199 from grails/197-assets-from-plugin-are-not-pa…
Browse files Browse the repository at this point in the history
…ckaged-by-default-need-to-add-packageplugin-=-true-in-buildgradle-file

For WEB_PLUGIN set packagePlugin prop
  • Loading branch information
puneetbehl authored Sep 23, 2023
2 parents 9ecdc55 + 52034c8 commit a17427f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void apply(GeneratorContext generatorContext) {
.buildscript());
generatorContext.addBuildPlugin(GradlePlugin.builder()
.id("com.bertramlabs.asset-pipeline")
.extension(new RockerWritable(assetPipelineExtension.template()))
.extension(new RockerWritable(assetPipelineExtension.template(generatorContext.getApplicationType())))
.build());

generatorContext.addDependency(Dependency.builder()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
@import org.grails.forge.application.ApplicationType

@args (
org.grails.forge.application.ApplicationType applicationType
)

assets {
@if (applicationType == ApplicationType.WEB_PLUGIN) {
packagePlugin = true
}
minifyJs = true
minifyCss = true
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,24 @@ assets {
}''')
}

void "test extension packagePlugin is set for application #applicationType"() {
when:
final String template = new BuildBuilder(beanContext)
.applicationType(applicationType)
.features(["asset-pipeline-grails"])
.render()

then:
template.contains('''
assets {
packagePlugin = true
minifyJs = true
minifyCss = true
}''')
where:
applicationType << [ApplicationType.WEB_PLUGIN]
}

void "test assets files are present"() {
given:
final Map<String, String> output = generate(ApplicationType.WEB, new Options(TestFramework.SPOCK, JdkVersion.JDK_11))
Expand Down

0 comments on commit a17427f

Please sign in to comment.