cleydyr / dart-sass-maven-plugin Goto Github PK
View Code? Open in Web Editor NEWA Maven plugin that allows to compile SASS using Dart Sass
License: MIT License
A Maven plugin that allows to compile SASS using Dart Sass
License: MIT License
Dear @cleydyr, can you please use the Release feature of GitHub to mark new versions? That would enable users to receive notifications upon new releases:
Can we add a many-to-many configuration setting to this plugin? There appears to be a loadPaths to add additional input folders, however I don't see how you would configure different outputs for those.
Due to a restriction in Dart Sass, the count of processed files may be incorrect. In the many-to-many mode, Dart Sass doesn't process regular CSS files if the input folder and the output folder are the same. So the count of processed files may be incorrect.
After a while after using version 1.2.0 of the plugin, I was no longer able to build my project since the plugin stucks after "Auto-detected operating system architecture: x64". The only way to build my project was to go back to version 1.1.0.
I experienced this problem in different projects on a Linux machine and on Windows. Running the build with -X
gives no further output.
Use https://github.com/sass/dart-sass/releases/latest.
Source #21
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.
Dart Sass has released Sass packages compatible with Linux OSes not built with glibc (Alpine, for example.) Since version 1.69.6. See sass/dart-sass#2148 and sass/dart-sass#1924.
This issue tracks adding an optional plugin flag to download the musl Sass release for Linux instead of the glibc (i.e., the regular) one.
Caused by: java.lang.NullPointerException at java.util.Objects.requireNonNull (Objects.java:221) at java.nio.file.Files.copy (Files.java:3035) at com.github.cleydyr.dart.system.io.PosixDartSassExecutableExtractor.extract (PosixDartSassExecutableExtractor.java:34) at com.github.cleydyr.maven.plugin.CompileSassMojo.extractExecutable (CompileSassMojo.java:236) at com.github.cleydyr.maven.plugin.CompileSassMojo.execute (CompileSassMojo.java:198) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289) at org.apache.maven.cli.MavenCli.main (MavenCli.java:193) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:566) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Hi,
I'm trying to replace EOL sass-maven-plugin with your dart-sass-maven-plugin but cannot seem to get it to compile, instead it crashes with following exception:
Can't execute SASS command
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
at org.codehaus.classworlds.Launcher.main (Launcher.java:47)
Caused by: org.apache.maven.plugin.MojoExecutionException: Can't execute SASS command
at com.github.cleydyr.maven.plugin.CompileSassMojo.execute (CompileSassMojo.java:208)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
at org.codehaus.classworlds.Launcher.main (Launcher.java:47)
Caused by: com.github.cleydyr.dart.command.exception.SassCommandException: Process exited with code 64
My current setup for the plugin is:
<plugin>
<groupId>io.github.cleydyr</groupId>
<artifactId>dart-sass-maven-plugin</artifactId>
<version>0.1.0</version>
<executions>
<execution>
<id>generate-css-using-sass</id>
<phase>generate-resources</phase>
<goals>
<goal>compile-sass</goal>
</goals>
<configuration>
<inputFolder>${basedir}/src/main/resources</inputFolder>
<outputFolder>${project.build.directory}/resources/css/sassy</outputFolder>
<loadPaths>
<path>${project.build.directory}/source-sass</path>
</loadPaths>
<update>true</update>
</configuration>
</execution>
</executions>
</plugin>
Since I am using unpacked webjars bootstrap and trying to extend its scss files I need to load additional path into the execution for the @imports to work. This seems to work fine with locally installed dart-sass with same inputs.
Any suggestions/ideas? Is this bug in the plugin or am I doing something wrong here?
With 1.3.0.
[ERROR] Failed to execute goal io.github.cleydyr:dart-sass-maven-plugin:1.3.0:compile-sass (generate-css-using-sass) on project designer:
Execution generate-css-using-sass of goal io.github.cleydyr:dart-sass-maven-plugin:1.3.0:compile-sass failed:
A required class was missing while executing io.github.cleydyr:dart-sass-maven-plugin:1.3.0:compile-sass: org/apache/commons/io/build/AbstractStreamBuilder
I think you need to upgrade to 2.15.1: https://commons.apache.org/proper/commons-io/
See #3 (comment)
We have issue that when running the plugin on our build server it no longer works due to following error:
Caused by: java.io.IOException: Cannot run program "/tmp/dart-sass-maven-plugin/linux/x64/1.69.3/sass": error=13, Permission denied
Currently running on version 1.1.0
but this worked in 0.3.0
- have not tried verisons in between.
Is this something that can be fixed in the plugin or is it configuration issue?
It could be useful for offline mode and air-gapped developers to allow the plugin to use the sass
executable to be found in PATH
instead of downloading or maintaining a <cachedFilesDirectory>
Could this be implement with an additional parameter or as a default failsafe behaviour?
Trying to run ...
mvn io.github.cleydyr:dart-sass-maven-plugin:0.2.0:watch-sass
I am getting this its looking at src\main\sass
and its not looking at my plugin config for which directory unless I am doing something wrong.
[INFO] --- dart-sass-maven-plugin:0.2.0:watch-sass (default-cli) @ primefaces-showcase ---
Error reading src\main\sass: Cannot open file.
Sass is watching for changes. Press Ctrl-C to stop.
How can I specify the target filename?
My source file is application.scss
and the final file becomes application.css
.
I want to control the output name to become application.min.css
.
It's otherwise blocking builds, see also sass/dart-sass#2110
The plugin should fallback to previous version when current version fails to download. If that also fails then fallback further to last successfully used locally cached version.
This plugin is wonderful!
I'm using <noSourceMap>true</noSourceMap>
but a source map is still being generated.
It's being executed through Eclipse using org.eclipse.m2e:lifecycle-mapping
but the other settings I have are being honored.
<configuration>
<inputFolder>${project.basedir}/src/main/resources/sass/</inputFolder>
<noSourceMap>true</noSourceMap>
<outputFolder>${project.basedir}/src/main/resources/static/css/</outputFolder>
<style>EXPANDED</style>
<update>true</update>
</configuration>
@cleydyr just a couple of things.
Warning: *****************************************************************
Warning: * Your build is requesting parallel execution, but this *
Warning: * project contains the following plugin(s) that have goals not *
Warning: * marked as thread-safe to support parallel execution. *
Warning: * While this /may/ work fine, please look for plugin updates *
Warning: * and/or request plugins be made thread-safe. *
Warning: * If reporting an issue, report it against the plugin in *
Warning: * question, not against Apache Maven. *
Warning: *****************************************************************
Warning: The following plugins are not marked as thread-safe in PrimeFaces Showcase:
Warning: io.github.cleydyr:dart-sass-maven-plugin:0.3.0
Warning:
Warning: Enable debug to see precisely which goals are not marked as thread-safe.
Warning: *****************************************************************
I wonder if we should update to the latest Dart SASS Exe's?
Finally I have been using this for months without issue maybe time for a 1.0.0 release?
File count is incorrectly calculated when the input folder contains subfolders with compilable sass/scss files.
Users may get this warning when requesting a parallel execution:
Warning: *****************************************************************
Warning: * Your build is requesting parallel execution, but this *
Warning: * project contains the following plugin(s) that have goals not *
Warning: * marked as thread-safe to support parallel execution. *
Warning: * While this /may/ work fine, please look for plugin updates *
Warning: * and/or request plugins be made thread-safe. *
Warning: * If reporting an issue, report it against the plugin in *
Warning: * question, not against Apache Maven. *
Warning: *****************************************************************
Warning: The following plugins are not marked as thread-safe in PrimeFaces Showcase:
Warning: io.github.cleydyr:dart-sass-maven-plugin:0.3.0
Warning:
Warning: Enable debug to see precisely which goals are not marked as thread-safe.
Warning: *****************************************************************
The goal of this issue is to mark the plugin goals as thread-safe if possible and document this feature regardless of the result.
Source: #21
It looks like the plugin is not using maven proxy settings when trying to download sass from Github.
We added explicit proxy settings to a Bamboo maven task, now sass is cached.
Best regards and thanks for this plugin.
See #23 (comment) and subsequent discussion.
A "watch" goal would be a useful addition.
Example from a Ruby Sass plugin: https://geodienstencentrum.github.io/sass-maven-plugin/watch-mojo.html
Since May the 30th, 2024, when compiling with this plugin, I receive a Windows error which says:
"[temp path]...no es una aplicación win32 válida".
I have Win 64 bits, and it seems that the plug-in correctly detects it (as the temp path, where the plugin puts dart.exe, contains x64 folder) but when compiling, the error mentioned appears.
Following the code published here, I guess this plug-in uses https://github.com/sass/dart-sass/releases/download/1.77.4/dart-sass-1.77.4-windows-x64.zip resource and extracts dart.exe from that source and download it to my temporary path (mentioned above), which as I could see has been modified exactly in May the 30th 2024.
I'm stucked with it. Could anyone please help me to solve this problem? I strongly need to compile my .sass files back again.
Thanks in advance.
Hi,
i have problems that sass won't compile my css Files (Error: Interpolation isn't allowed in plain CSS) but it is not needed to compile css!
Is it possible to add an extra option to ignore css Files? Or maybe support of * in inputFolder like src/main/webapp/resources/**/*.scss?
Thanks
Daniel
When setting noSourceMap
option, the build fails because AbstractSassCommand
also passes --source-map-urls
option to the executable. It returns with exit code 64 with no other error message in the log.
To get to what its problem was I had to debug the plugin to get the executed command, and call it from command line to see the actual error message returned by the executable. It seems that the error message is printed on the standard out (along with the usage instructions).
Please note I'm on Apple Silicon. Maybe Windows handles the process outputs differently.
I checked out your project and ran mvn clean package
and its failing. Full log attached:
failure.txt
Apache Maven 3.8.5
Maven home: C:\Tools\apache-maven-3.8.1\bin..
Java version: 11.0.10, vendor: AdoptOpenJDK, runtime: C:\Tools\jdk-11.0.10
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean (default-cli) on project dart-sass-maven-plugin: Failed to clean project: Failed to delete C:\dev\melloware-git\dart-sass-maven-plugin\target\surefire\surefirebooter3636085958289191551.jar -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean (default-cli) on project dart-sass-maven-plugin: Failed to clean project: Failed to delete C:\dev\melloware-git\dart-sass-maven-plugin\target\surefire\surefirebooter3636085958289191551.jar
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.