Skip to content
Clojure compiler for SASS, for Lein and Boot, using Libsass Java wrapper
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
test-resources
test/sass4clj
.gitignore
.travis.yml
CHANGELOG.md
CONTRIBUTING.md
README.md
appveyor.yml
boot.properties
build.boot
deps.edn
test.sh

README.md

Sass4clj

Clojars Project Build Status AppVeyor Downloads Dependencies Status

Clojure wrapper for jsass JNA wrapper for Libsass. This repository also contains Boot and Leiningen tasks.

For parallel Less library check less4clj

Features

  • Jsass features
    • Requires Java 1.8
    • Linux & Windows builds are automatically tested
    • (Doesn't work on Alpine based Docker images)
  • Load imports directly from Java classpath (e.g. Webjars)
    • Add dependency [org.webjars.bower/bootstrap "4.0.0-alpha"] to use Bootstrap
  • Assumes that files starting with _ are partial files and should not be compiled into CSS files.

Boot Clojars Project Downloads

  • Provides the sass task (deraen.boot-sass/sass)
  • For each .sass or .scss file not starting with _ in the fileset creates equivalent .css file.
  • Check boot sass --help for task options.

Leiningen Clojars Project Downloads

  • Provides the sass4clj task
  • For each .sass or .scss file not starting with _ in source-dirs creates equivalent .css file.
  • Check lein help sass4clj for options.

Clj

Test in the repository:

clj -m sass4clj.main --source-paths test-resources

Check clj -m sass4clj.main --help for options.

Import load order

Loading order for @import "{name}"; on file at {path}

  1. Local file at {path}/{name}.sass or {path}/{name}.scss
  2. Classpath resource (io/resource "{name}.ext")
  3. Classpath resource (io/resource "{path}/{name}.ext")
  4. Webjar asset
    • Resource META-INF/resources/webjars/{package}/{version}/{path} can be referred using {package}/{path}
    • For example @import "bootstrap/scss/bootstrap.scss"; will import META-INF/resources/webjars/bootstrap/4.0.0-alpha/scss/bootstrap.scss

FAQ

Log configuration

If you don't have any slf4j implementations you will see a warning:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

To disable this add a no operation logger to your project. As this is only required on build phase, you can use :scope "test" so that the dependency is not transitive and is not included in uberjar. Alternatively you can add this dependency to your Leiningen dev profile.

[org.slf4j/slf4j-nop "1.7.13" :scope "test"]

License

Copyright © 2014-2017 Juho Teperi

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

You can’t perform that action at this time.