bertramdev / asset-pipeline

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

groocss extension module methods not working #320

Closed mariogarcia closed 1 year ago

mariogarcia commented 1 year ago

Hi, nice project BTW!:

Problem

I'm using the groocss assets-pipelines plugin in version 4.0.0 and it seems that I can't use measurement methods from the extension module.

Screenshot from 2022-12-08 19-58-32

At the moment I have to hardcoded the measurements, but if you uncomment the problematic line in this file it will fail:

p  {
  add '> a.doc_link', {
    color '#fff'
    // paddingLeft 1.em // <-- fails
    paddingLeft '1em'
  }
}

How to reproduce

I've created an example project where you can reproduce the behavior by uncomment the aforementioned line at https://github.com/mariogarcia/asset-pipelines-example.

./gradlew assetClean assetCompile

Versions

Cheers! Mario

mariogarcia commented 1 year ago

I've added the groovy plugin to the project with groovy-all as it is suggested in the README. Nothing changed still complaining.

mariogarcia commented 1 year ago

It is still don't working but at least I'm figuring out a little bit more on how dependencies work :

I though marking a Gradle dependency with an assets scope implied that dependency was included in the Gradle's compileClasspath too. But it didn't.

So changing:

assets("com.bertramlabs.plugins:groocss-asset-pipeline:$assets_pipeline") 

to this:

compile("com.bertramlabs.plugins:groocss-asset-pipeline:$assets_pipeline") 

At least make the compiler happy, but on the other hand the resulting css file looks like assetCompile hasn't processed the groocss code. The css file contains the groocss code unchanged.

And finally, if I added both:

assets("com.bertramlabs.plugins:groocss-asset-pipeline:$assets_pipeline") 
compile("com.bertramlabs.plugins:groocss-asset-pipeline:$assets_pipeline") 

Makes the compiler to complain again.

mariogarcia commented 1 year ago

I'm chaning strategy. Now I'm excluding current version of Groocss from 1.0-M1 to 1.0-M2 and now everything works. Compilation works and asset processing works as well.

assets('org.groocss:groocss:1.0-M2')
assets("com.bertramlabs.plugins:groocss-asset-pipeline:$assets_pipeline") {
    exclude group: "org.groocss", module: "groocss"
}

So it seems to be something broken in Groocss in version 1.0-M1. I'm opening a pull request.

mariogarcia commented 1 year ago

I realized it is also working by bumping the Gradle asset-pipline plugin to version 3.4.4.

plugins {
    id 'groovy'
    id "com.bertramlabs.asset-pipeline" version "3.4.4"
}

repositories {
    jcenter()
    mavenCentral()
}

dependencies {
    assets "com.bertramlabs.plugins:asset-pipeline-core:4.0.0"
    assets "com.bertramlabs.plugins:jsx-asset-pipeline:4.0.0"
    assets "com.bertramlabs.plugins:typescript-asset-pipeline:4.0.0"
    assets "com.bertramlabs.plugins:groocss-asset-pipeline:4.0.0"
}

assets {
    minifyJs         = true
    minifyCss        = true
    enableSourceMaps = true
    maxThreads       = 8
    configOptions    = [
        commonJs: true,
        enableES6: false,
        groocss: [
            prettyPrint: false,
            compress: true,
            noExts: false,
            convertUnderline: false
        ]
    ]
    excludes = [
        'components/*',
        'react*.js',
        'layout/*',
        'custom/*.css',
        '*.groocss',
    ]
}

So it seems that the sweetspot is:

Closing this issue