bertramdev / asset-pipeline

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

SassAssetFile not registered because it does not implement the AssetFile interface #310

Closed tveimo closed 2 years ago

tveimo commented 2 years ago

I am getting this error, so am unable to use sass-dart. No css is generated resulting in a 404;

WARN asset.pipeline.AssetSpecLoader.invoke(104) [] Asset specification asset.pipeline.dart.SassAssetFile not registered because it does not implement the AssetFile interface

Am unsure which details to provide to help resolve this?

Setting developmentRuntime to false doesn't get rid of the warning, but at least the css is compiled.

build.gradle;

buildscript { repositories { maven { url 'https://jitpack.io' } mavenCentral() } dependencies { classpath 'com.bertramlabs.plugins:asset-pipeline-gradle:3.4.6' classpath 'com.bertramlabs.plugins:less-asset-pipeline:3.4.6' classpath 'com.bertramlabs.plugins:sass-dart-asset-pipeline:3.4.6' classpath 'org.springframework.boot:spring-boot-gradle-plugin:2.6.11' } }

plugins { id 'org.springframework.boot' version '2.6.11' id 'java' id 'com.github.node-gradle.node' version '3.1.1' }

apply plugin: 'war' apply plugin: 'io.spring.dependency-management' apply plugin: 'com.bertramlabs.asset-pipeline'

version = '0.2-SNAPSHOT' sourceCompatibility = '11'

task processPackageResources(type: Copy) { duplicatesStrategy = 'include' }

springBoot { buildInfo() }

assets { minifyJs = true minifyCss = true enableSourceMaps = true

configOptions = [

/ sass: [ quietDeps: false, outputStyle: 'compressed' ] ]

includes = [ '*.less', '*.css', '*.scss', '*.sass' ]
excludes = [ '**/*.less', 'bootstrap4/**', 'bootstrap4-extra/**', 'bootstrap4-local/**', 'local/**', 'external/**' ]

def dm = System.getProperty('developmentRuntime') ?: true
println "development runtime? " + dm
if (dm == true) {
    println "asset pipeline development runtime turned on"
    developmentRuntime = true
} else {
    println "asset pipeline development runtime turned off"
    developmentRuntime = false
}

}

repositories { maven { url 'https://jitpack.io' } mavenCentral() }

configurations { all { exclude group: 'com.google.collections', module: 'google-collections' exclude group: 'commons-logging', module: 'commons-logging' exclude group: 'log4j', module: 'log4j' exclude group: 'com.google.guava', module: 'guava-jdk5' exclude group: 'com.vaadin.external.google', module: 'android-json' } dev }

dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs')

implementation 'com.bertramlabs.plugins:asset-pipeline-spring-boot:3.4.6'
implementation 'com.bertramlabs.plugins:asset-pipeline-core:3.4.6'
implementation 'com.bertramlabs.plugins:less-asset-pipeline:3.4.6'
implementation 'com.bertramlabs.plugins:sass-dart-asset-pipeline:3.4.6'

implementation 'org.springframework.boot:spring-boot-devtools'

[...] }

tveimo commented 2 years ago

I'm thinking this is an issue with the specific class loaders used in my deployment setup, running with embedded tomcat spun off with spring boot inside intellij.

tveimo commented 2 years ago

Looks like AssetSpecLoader is loaded by org.springframework.boot.devtools.restart.classloader.RestartClassLoader while SassAssetFile is loaded by jdk.internal.loader.ClassLoaders.AppClassLoader.

tveimo commented 2 years ago

Removing this line from build.gradle fixes it;

implementation 'org.springframework.boot:spring-boot-devtools:2.6.12'

which unfortunately has other side effects. But will close this issue with this comment.

tveimo commented 2 years ago

Just for completeness for others having the same issue, it's possible to still use spring boot devtools if the following line is added to META-INF/spring-devtools.properties;

restart.include.sass-dart=/sass-dart-asset-pipeline-.+.jar