warmuuh / libsass-maven-plugin

libsass wrapper for maven
115 stars 41 forks source link
java libsass maven sass

Unmaintained

this project is no longer maintained but a fork is: https://gitlab.com/haynes/libsass-maven-plugin

Libsass Maven Plugin Build Status Maven Central

Libsass Maven Plugin uses libsass to compile sass files. Uses jsass to interface with C-library.

Changelog:

Installation

libsass-maven-plugin is available on central-repository since version 0.1.2

Usage

Configure plugin in your pom.xml:

<build>
   <plugins>
      <plugin>
         <groupId>com.github.warmuuh</groupId>
         <artifactId>libsass-maven-plugin</artifactId>
         <version><VERSION>-libsass_3.4.4</version>
         <executions>
            <execution>
               <phase>generate-resources</phase>
               <goals>
                  <goal>compile</goal>
               </goals>
            </execution>
         </executions>
         <configuration>
            <inputPath>${basedir}/src/main/sass/</inputPath>
            <outputPath>${basedir}/target/</outputPath>
            <includePath>${basedir}/src/main/sass/plugins/</includePath>
         </configuration>
      </plugin>
   </plugins>
</build>

Alternatively, you can use the watch goal to have the plugin watch your files and recompile on change:

mvn com.github.warmuuh:libsass-maven-plugin:<version>-libsass_3.4.4:watch

Configuration Elements

Element Default value Documentation
outputPath ${project.build.directory} The directory in which the compiled CSS files will be placed.
inputPath src/main/sass The directory from which the source .scss files will be read. This directory will be traversed recursively, and all .scss files found in this directory or subdirectories will be compiled.
includePath null Additional include path, ';'-separated
outputStyle nested Output style for the generated css code. One of nested, expanded, compact, compressed. Note that as of libsass 3.1, expanded and compact result in the same output as nested.
generateSourceComments false Emit comments in the compiled CSS indicating the corresponding source line. The default value is false.
generateSourceMap true Generate source map files. The generated source map files will be placed in the directory specified by sourceMapOutputPath.
sourceMapOutputPath ${project.build.directory} The directory in which the source map files that correspond to the compiled CSS will be placed
omitSourceMapingURL false Prevents the generation of the sourceMappingURL special comment as the last line of the compiled CSS.
embedSourceMapInCSS false Embeds the whole source map data directly into the compiled CSS file by transforming sourceMappingURL into a data URI.
embedSourceContentsInSourceMap false Embeds the contents of the source .scss files in the source map file instead of the paths to those files
inputSyntax scss Switches the input syntax used by the files to either sass or scss.
precision 5 Precision for fractional numbers
enableClasspathAwareImporter false Enables classpath aware importer which make possible to @import files from classpath and WebJars. For classpath resources use @import 'path/to/resource/in/classpath';. For WebJar resources a shortcut can be used: @import '{package}/{path}'; imports resource META-INF/resources/webjars/{package}/{version}/{path}.
failOnError true should fail the build in case of compilation errors.
copySourceToOutput false copies all files from source directory to output directory

License

MIT License.