All Projects → Deraen → sass4clj

Deraen / sass4clj

Licence: other
SASS compiler for Clj, Lein and Boot, using Libsass Java wrapper

Programming Languages

clojure
4091 projects

Projects that are alternatives of or similar to sass4clj

vim-jack-in
cider-jack-in for vim
Stars: ✭ 42 (-40%)
Mutual labels:  boot, leiningen
boot-bundle
boot-bundle: managed dependencies for boot, the clojure build tool
Stars: ✭ 43 (-38.57%)
Mutual labels:  boot, boot-tasks
spring-microservices
Spring Cloud Micro Services with Eureka Discovery, Zuul Proxy, OAuth2 Security, Hystrix CircuitBreaker, Sleuth Zipkin, ELK Stack Logging, Kafka, Docker and many new features
Stars: ✭ 114 (+62.86%)
Mutual labels:  boot
test-refresh
Refreshes and reruns clojure.tests in your project.
Stars: ✭ 376 (+437.14%)
Mutual labels:  leiningen
TC1791 CAN BSL
CAN Bootstrap Loader (BSL) for Tricore AudoMAX (TC1791 and friends), including arbitrary read/write as well as compressed read functionality.
Stars: ✭ 25 (-64.29%)
Mutual labels:  boot
cljsee
Backporting cljc
Stars: ✭ 26 (-62.86%)
Mutual labels:  leiningen
lein-nsorg
Leiningen plugin for organizing ns form
Stars: ✭ 46 (-34.29%)
Mutual labels:  leiningen
arch-config
Scripts and Ansible playbook to setup Arch Linux on ZFS.
Stars: ✭ 36 (-48.57%)
Mutual labels:  boot
mbr-boot-manager
💾 Master Boot Record with a boot menu written in Assembly
Stars: ✭ 57 (-18.57%)
Mutual labels:  boot
bananapi-zero-ubuntu-base-minimal
BananaPi M2 Zero - Ubuntu Focal Base Minimal Image (Experimental) - U-Boot 2017.09 / Kernel 4.18.y / Kernel 4.19.y / Kernel 4.20.y / Kernel 5.3.y / Kernel 5.6.y / Kernel 5.7.y / Kernel 5.11.y
Stars: ✭ 77 (+10%)
Mutual labels:  boot
GrubFM-Installer
GrubFM Installer
Stars: ✭ 27 (-61.43%)
Mutual labels:  boot
rpooler
A guided installation script for zfs rpools
Stars: ✭ 30 (-57.14%)
Mutual labels:  boot
Multiboot-Toolkit
Create a bootable disk
Stars: ✭ 96 (+37.14%)
Mutual labels:  boot
unlock-luks-partition
Unlock a LUKS partition via SSH
Stars: ✭ 31 (-55.71%)
Mutual labels:  boot
lein-jlink
A lein plugin creates and manages custom java environment
Stars: ✭ 59 (-15.71%)
Mutual labels:  leiningen
c-sharp
ymodem bootloader
Stars: ✭ 41 (-41.43%)
Mutual labels:  boot
springboot-mongodb-security
Spring Boot, Security, and Data MongoDB Authentication Example
Stars: ✭ 22 (-68.57%)
Mutual labels:  boot
libsass-asm
WebAssembly based Javascript bindings for libsass
Stars: ✭ 47 (-32.86%)
Mutual labels:  libsass
React-Springboot-App
Spring Boot is an open source Java-based framework used to create a micro Service. It is developed by Pivotal Team and is used to build stand-alone and production ready spring applications and React is a free and open-source front-end JavaScript library for building user interfaces based on UI components.
Stars: ✭ 22 (-68.57%)
Mutual labels:  boot
Arch
These are easy, in-depth instructions on how to install Arch Linux.
Stars: ✭ 16 (-77.14%)
Mutual labels:  boot

Sass4clj

Clojars Project Build Status AppVeyor

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

For parallel Less library check less4clj

ATTENTION: libsass (the C library) and the JNA wrapper library jsass are deprecated. Consider using Dart Sass if you do not need to read SCSS files from the Java classpath. You can integrate Dart Sass process with Shadow CLJS.

Both sass4clj still works and will receive bug fixes, but the difference between libsass and dart-sass will continue growing.

Some ideas if you need to read files from the classpath or jar files:

  • It might be possible to extend dart-sass through Importer API
  • Extract files from the jar files in a script before calling dart-sass compile (for example, using clj and unzip)

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.
  • Non feature: compilation warnings are reported by libsass/jsass directly to stdout, and aren't accessible from sass4clj API.

Boot Clojars Project

  • Provides the sass task (deraen.boot-sass/sass)
  • Select main files using inputs option
  • or, 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

  • Provides the sass4clj task
  • Select main files using inputs option
  • or, 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. Local files on other source-paths, {source-path}/{name}.ext
  3. Classpath resource (io/resource "{name}.ext")
  4. Classpath resource (io/resource "{path}/{name}.ext")
  5. 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

Shadow-cljs integration

If you want to combine CLJS compilation with Shadow CLJS and Sass compilation, you can create your function which starts both watches and run this using shadow-cljs clj-run task.

(ns app.shadow
  (:require [shadow.cljs.devtools.api :as shadow]
            [sass4clj.api :as sass]
            [clojure.edn :as edn]))

(defn watch
  {:shadow/requires-server true}
  [& _args]
  ;; Sass compilation probably starts faster.
  ;; Both watches keep running until ctrl-c.
  (sass/start (-> (edn/read-string (slurp "sass4clj.edn"))
                  (assoc :target-path "target/dev/public/css")))
  (shadow/watch :app))

The configuration file, sass4clj.edn, is also supported by sass4clj.main namespace. You could use that to compile CSS for your production build instead of the leiningen plugin.

And start the watch with (or with whatever tool you are using):

lein run -m shadow.cljs.devtools.cli clj-run app.shadow/watch

You need to ensure that the classpath used by shadow-cljs contains deraen/sass4clj and any packages where you are importing sass files from.

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 the 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-2021 Juho Teperi

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].