Skip to content

Commit

Permalink
update sass stuff to align with new schema validations
Browse files Browse the repository at this point in the history
  • Loading branch information
lacarmen committed Mar 25, 2017
1 parent dec1087 commit 9381328
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/cryogen_core/compiler.clj
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@
(s/validate schemas/Config config)
(-> config
(update-in [:tag-root-uri] (fnil identity ""))
(update-in [:sass-src] (fnil identity "css"))
(update-in [:sass-src] (fnil identity ["css"]))
(update-in [:sass-path] (fnil identity "sass"))
(update-in [:compass-path] (fnil identity "compass"))
(assoc :page-root-uri (root-uri :page-root-uri config)
Expand Down
38 changes: 18 additions & 20 deletions src/cryogen_core/sass.clj
Original file line number Diff line number Diff line change
Expand Up @@ -37,29 +37,27 @@
same dir. All error handling is done by sh / launching the sass
command."
[{:keys [sass-dir sass-path compass-path base-dir]}]
(shell/with-sh-dir base-dir
(shell/with-sh-dir
base-dir
(if (compass-installed? compass-path)
(sh sass-path "--compass" "--update" sass-dir)
(sh sass-path "--update" sass-dir))))

(defn compile-sass->css!
"Given a directory or directories in sass-src, looks for all Sass
files and compiles them. Prompts you to install sass if it finds
Sass files but can't find the command. Shows you any problems it
comes across when compiling. "
"Given a directory or directories in sass-src, looks for all Sass files and compiles them.
Prompts you to install sass if it finds Sass files but can't find the command. Shows you
any problems it comes across when compiling. "
[{:keys [sass-src sass-path ignored-files base-dir] :as opts}]
(let [sass-src (if (coll? sass-src) sass-src [sass-src])]
(if (and (not (empty? sass-src))
(not (sass-installed? sass-path)))
(println (red (str "Sass seems not to be installed, but you have scss / sass files in "
sass-src
" - You might want to install it here: sass-lang.com")))
(doseq [sass-dir sass-src]
(when (seq (find-sass-files base-dir sass-dir ignored-files))
(do
(println "\t" (cyan sass-dir) "-->" (cyan sass-dir))
(let [result (compile-sass-dir! (assoc opts :sass-dir sass-dir))]
(if (zero? (:exit result))
(println "Successfully compiled sass files")
(println (red (:err result))
(red (:out result)))))))))))
(if (and (not (empty? sass-src))
(not (sass-installed? sass-path)))
(println
(red (str "Sass seems not to be installed, but you have scss / sass files in "
sass-src
" - You might want to install it here: sass-lang.com")))
(doseq [sass-dir sass-src]
(when (seq (find-sass-files base-dir sass-dir ignored-files))
(println "\t" (cyan sass-dir) "-->" (cyan sass-dir))
(let [result (compile-sass-dir! (assoc opts :sass-dir sass-dir))]
(if-not (zero? (:exit result))
(println (red (:err result))
(red (:out result)))))))))
2 changes: 1 addition & 1 deletion src/cryogen_core/schemas.clj
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
:recent-posts s/Int
:post-date-format s/Str
(s/optional-key :archive-group-format) s/Str
(s/optional-key :sass-src) s/Str
(s/optional-key :sass-src) [s/Str]
(s/optional-key :sass-path) s/Str
(s/optional-key :compass-path) s/Str
:theme s/Str
Expand Down
4 changes: 2 additions & 2 deletions test/cryogen_core/compiler_test.clj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(ns cryogen-core.compiler-test
(:require [clojure.java.io :as io]
[clojure.test :refer :all]
[clojure.test :refer :all]
[me.raynes.fs :as fs]
[cryogen-core.compiler :refer :all]
[cryogen-core.markup :as m])
Expand Down Expand Up @@ -147,7 +147,7 @@ and more content.
:recent-posts 3
:post-date-format "yyyy-MM-dd"
:archive-group-format "yyyy MMMM"
:sass-src ""
:sass-src []
:sass-dest nil
:sass-path "sass"
:compass-path "compass"
Expand Down

0 comments on commit 9381328

Please sign in to comment.