libsass

JNA wrapper around libsass

Лицензия

Лицензия

Категории

Категории

Java Языки программирования
Группа

Группа

com.cathive.sass
Идентификатор

Идентификатор

sass-java
Последняя версия

Последняя версия

4.0.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

libsass
JNA wrapper around libsass
Ссылка на сайт

Ссылка на сайт

https://github.com/cathive/sass-java/
Организация-разработчик

Организация-разработчик

The Cat Hive Developers
Система контроля версий

Система контроля версий

https://github.com/cathive/sass-java/

Скачать sass-java

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.cathive.sass/sass-java/ -->
<dependency>
    <groupId>com.cathive.sass</groupId>
    <artifactId>sass-java</artifactId>
    <version>4.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.cathive.sass/sass-java/
implementation 'com.cathive.sass:sass-java:4.0.0'
// https://jarcasting.com/artifacts/com.cathive.sass/sass-java/
implementation ("com.cathive.sass:sass-java:4.0.0")
'com.cathive.sass:sass-java:jar:4.0.0'
<dependency org="com.cathive.sass" name="sass-java" rev="4.0.0">
  <artifact name="sass-java" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.cathive.sass', module='sass-java', version='4.0.0')
)
libraryDependencies += "com.cathive.sass" % "sass-java" % "4.0.0"
[com.cathive.sass/sass-java "4.0.0"]

Зависимости

compile (4)

Идентификатор библиотеки Тип Версия
net.java.dev.jna : jna jar 4.1.0
com.nativelibs4java : jnaerator-runtime jar 0.11
com.google.code.findbugs : annotations Необязательный jar 3.0.0
com.google.guava : guava jar 18.0

provided (3)

Идентификатор библиотеки Тип Версия
javax.inject : javax.inject Необязательный jar 1
javax.validation : validation-api Необязательный jar 1.1.0.Final
org.apache.ant : ant jar 1.9.6

runtime (1)

Идентификатор библиотеки Тип Версия
net.java.dev.jna : jna-platform jar 4.1.0

test (10)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.12
org.mockito : mockito-core jar 1.10.17
com.helger : ph-css jar 3.8.2
org.slf4j : slf4j-jdk14 jar 1.7.9
org.springframework : spring-beans jar 4.1.3.RELEASE
org.springframework : spring-context jar 4.1.3.RELEASE
org.springframework : spring-context-support jar 4.1.3.RELEASE
org.springframework : spring-test jar 4.1.3.RELEASE
org.hibernate : hibernate-validator-annotation-processor jar 5.1.3.Final
org.apache.ant : ant-testutil jar 1.9.6

Модули Проекта

Данный проект не имеет модулей.

libsass for Java

A JNA binding to access libsass functionality.

A compiled and ready-to-use version of this library can be found in the in the Maven Central repository. To use the library in your Maven based projects just add the following lines to your 'pom.xml':

<dependency>
  <groupId>com.cathive.sass</groupId>
  <artifactId>sass-java</artifactId>
  <version>${sass-java.version}</version>
</dependency>

Versions

libsass for Java uses Semantic Versioning. MAJOR, MINOR and PATCH version are used for the library / Java binding itself. The BUILD METADATA component of the version is used to describe to version of the underlying native C/C++ libsass component.

Native libraries

Compiled dynamic libraries of libsass are bundled inside of the JAR artifact together with the required auto-generated JNA binding classes and nice wrapper classes to allow for a Java-like feeling when working with libsass.

Supported platforms

This is the list of platforms that are directly supported, because the dynamic library has been pre-compiled and bundled:

  • Linux x86-64
  • Linux x86
  • Mac OS X x86-64
  • Windows x86-64
  • Windows x86

If your desired platform / architecture is missing, feel free to open an issue and add a pre-compiled version of libsass for inclusion!

Example code

import com.cathive.sass.SassCompilationException;
import com.cathive.sass.SassContext;
import com.cathive.sass.SassFileContext;
import com.cathive.sass.SassOptions;
import com.cathive.sass.SassOutputStyle;

import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;

/**
 * A little example to demonstrate some of the features of sass-java.
 */
class SimpleSassExample {

    public static void main(String... args) {

        // Our root directory that contains the
        Path srcRoot = Paths.get("/path/to/my/scss/files");

        // Creates a new sass file context.
        SassContext ctx = SassFileContext.create(srcRoot.resolve("styles.scss"));

        SassOptions options = ctx.getOptions();
        options.setIncludePath(
                srcRoot,
                Paths.get("/another/include/directory"),
                Paths.get("/and/yet/another/include/directory")
                //[...] varargs can be passed to add even more include directories.
        );
        options.setOutputStyle(SassOutputStyle.NESTED);
        // any other options supported by libsass including source map stuff can be configured
        // as well here.

        // Will print the compiled CSS contents to the console. Use a FileOutputStream
        // or some other fancy mechanism to redirect the output to wherever you want.
        try {
            ctx.compile(System.out);
        } catch (SassCompilationException e) {
            // Will print the error code, filename, line, column and the message provided
            // by libsass to the standard error output.
            System.err.println(e.getMessage());
        } catch (IOException e) {
            System.err.println(String.format("Compilation failed: %s", e.getMessage()));
        }
    }

}

Ant Task Example

This example shows how to invoke sass-java from Ant using the bundled Ant task and the maven-antrun-plugin.

<plugin>
    <artifactId>maven-antrun-plugin</artifactId>
    <version>1.7</version>
    <executions>
        <execution>
            <phase>generate-sources</phase>
            <configuration>
                <target>
                    <path id="plugin.classpath">
                        <path path="${maven.plugin.classpath}"/>
                    </path>
                    <taskdef name="sass" classname="com.cathive.sass.SassTask" classpathref="plugin.classpath"/>
                    <delete dir="${output.dir}"/>
                    <sass in="${sass.srcdir}" outdir="${output.dir}">
                        <!--
                            Note that the task takes a nested `path` element to reference any Sass include directories.
                        -->
                        <path>
                            <pathelement location="${include1.dir}"/>
                            <pathelement location="${include2.dir}"/>
                        </path>
                    </sass>
                </target>
            </configuration>
            <goals>
                <goal>run</goal>
            </goals>
        </execution>
    </executions>
    <dependencies>
        <dependency>
            <groupId>com.cathive.sass</groupId>
            <artifactId>sass-java</artifactId>
            <version>${sass-java.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.ant</groupId>
            <artifactId>ant</artifactId>
            <version>1.9.6</version>
        </dependency>
    </dependencies>
</plugin>

Ant Task Attributes

in (Path to a directory that contains scss files or a single scss file)

outdir (Directory path where the compiled css should be placed)

precision (number)

outputstyle (0 = nested, 1 = expanded, 2 = compact, 3 = compressed)

sourcecomments (true/false)

sourcemapembed (true/false)

sourcemapcontents (true/false)

omitsourcemapurl (true/false)

isindentedsyntaxsrc (true/false)

sourcemapfile (Path to source map file)

sourcemaproot (Directly inserted in source maps)

com.cathive.sass

The Cat Hive Developers

Версии библиотеки

Версия
4.0.0
3.2.5.0