dart-sass-maven-plugin
dart-sass-maven-plugin copied to clipboard
Add classpath to loadPath
The libsass-maven-plugin plugin has the option to allow classpath resources to be used as imports:
@import "META-INF/resources/webjars/bootstrap-sass/assets/stylesheets/bootstrap/variables";
This functionality was provided by ClasspathAwareImporter.java.
Is it possible to add similar functionality to the dart-sass-maven-plugin?
My current workaround is to have maven-dependency-plugin extract some dependencies into a directory and add that directory as loadPath.
+1 on the suggestion!
Hey, @qsiebers .
Honestly, even though this is possible, that feature you mentioned counts on JSass, which is a Sass compiler itself. I don't envision this plugin as being so powerful as to contain a parser and catch up with the Dart Sass parser itself.
Integrating JSass in this plugin was definitely not my goal :). Rather to find a way to reproduce the functionality.
I understand that it is not an easy to implement enhancement. If I ever find enough time to implement it, I'll submit it as a MR.
I think this could be achievable by communicating with dart sass over the embedded sass protocol (its quite powerful and supports things like custom importers) instead of just invoking it using CLI parameters
There also already exists an awesome java binding for this: https://github.com/larsgrefer/dart-sass-java, even already has an importer for webjars that appears to be compatible with how the libsass-maven-plugin works
Switching the actual "sass host" implementation (invoking the cli vs sass embedded) might be a breaking change though and requires a bit more glue code in this plugin (i.e. walking an input dir for .scss/.sass or watching files is not something the embedded protocol supports)
First, thank you for offering a new perspective on this problem, @jungm. I really appreciate it.
The change may not be breaking if we introduce an option to use the embedded Sass protocol for those who need it and leave the default implementation as the CLI.