Deraen / sass4clj

SASS compiler for Clj, Lein and Boot, using Libsass Java wrapper
70 stars 16 forks source link

Boot sass task does not respect target env #12

Closed dimitertodorov closed 8 years ago

dimitertodorov commented 8 years ago

I have the following task. It compiles fine, but keeps outputting files to target. I want it to compile into compiled_css instead.

Main reason, is I would like to run SASS compilation on its own.

(set-env!
  :source-paths #{"src/cljs" "test/clj"}
  :resource-paths #{"src/clj" "src/cljc" "resources"}
  :dependencies '[
                  [adzerk/boot-cljs "1.7.228-1" :scope "test"]
                  [adzerk/boot-cljs-repl "0.3.0" :scope "test"]
                  [adzerk/boot-reload "0.4.5" :scope "test"]
                  [pandeiro/boot-http "0.7.1-SNAPSHOT" :scope "test"]
                  [crisptrutski/boot-cljs-test "0.2.2-SNAPSHOT" :scope "test"]
                  [org.clojure/clojure "1.7.0"]
                  [org.clojure/clojurescript "1.7.228"]
                  [adzerk/boot-test "1.1.1" :scope "test"]
                  [com.cemerick/piggieback "0.2.1" :scope "test"]
                  [weasel "0.7.0" :scope "test"]
                  [org.clojure/tools.nrepl "0.2.12" :scope "test"]
                  [org.clojure/core.async "0.2.374"
                   :exclusions [org.clojure/tools.reader]]
                  [sablono "0.4.0"]
                  [devcards "0.2.1-5"]
                  [deraen/boot-sass "0.2.1"]
                  [org.omcljs/om "1.0.0-alpha32" :exclusions [org.clojure/clojure]]])

(require
  '[adzerk.boot-cljs :refer [cljs]]
  '[adzerk.boot-cljs-repl :refer [cljs-repl start-repl repl-env]]
  '[adzerk.boot-reload :refer [reload]]
  '[adzerk.boot-test :refer [test]]
  '[deraen.boot-sass :refer [sass]]
  '[pandeiro.boot-http :refer [serve]])

(task-options!
  pom {:project     'torca
       :version     "0.1.0-SNAPSHOT"
       :description "TORCA CLJS Front-End"
       :license     {"The MIT License (MIT)" "http://opensource.org/licenses/mit-license.php"}}
  aot {:namespace #{'backend.main}}
  jar {:main 'backend.main}
  cljs {:source-map true})

(deftask dev
         "Start the dev env..."
         [s speak bool "Notify when build is done"
          p port PORT int "Port for web server"]
         (comp
           (watch)
           (reload :on-jsload 'torca.core/reload)
           (cljs-repl)
           (cljs :compiler-options {:devcards true})
           (serve :port port, :dir "target")
           (target)
           (if speak (boot.task.built-in/speak) identity)))

(deftask styles []
         "Compile Styles"
         (set-env! :source-paths #{"sass"}
                   :target "compiled_css")
        (comp (watch)
              (speak)
              (sass)
              (target)))
(deftask run-tests []
         (test))

(deftask autotest []
         (comp
           (watch)
           (run-tests)))

(deftask package
         "Build the package"
         []
         (comp
           (cljs :compiler-options {:devcards false :optimizations :advanced})
           (target)))
martinklepsch commented 8 years ago

@dimitertodorov the target task takes the target directory as a task option. the env :target thing will be deprecated in the future.