From fc1d1d725c2e6290f586a253bddcd35d26ac84c2 Mon Sep 17 00:00:00 2001 From: Ben Swift Date: Fri, 2 Dec 2016 11:55:47 +1100 Subject: [PATCH 1/3] bugfix for compass-installed? catch the (previously uncaught) exception when there isn't a `compass` binary on the `$PATH`, return `false` instead --- src/cryogen_core/sass.clj | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/cryogen_core/sass.clj b/src/cryogen_core/sass.clj index 6e4d8c8..4ddb7cd 100644 --- a/src/cryogen_core/sass.clj +++ b/src/cryogen_core/sass.clj @@ -15,9 +15,12 @@ (= 0 (:exit (sh "sass" "--version")))) (defn compass-installed? - "Checks for the installation of Compass." - [] - (= 0 (:exit (sh "compass" "--version")))) + "Checks for the installation of Compass." + [] + (try + (= 0 (:exit (sh "compass" "--version"))) + (catch java.io.IOException _ + false))) (defn find-sass-files "Given a Diretory, gets files, Filtered to those having scss or sass From a66f8df5e41885cce995f567afe8fdaa5994511b Mon Sep 17 00:00:00 2001 From: Ben Swift Date: Fri, 2 Dec 2016 14:30:11 +1100 Subject: [PATCH 2/3] in compile-sass-file!, sh doesn't like nil arg when no compass --- src/cryogen_core/sass.clj | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/cryogen_core/sass.clj b/src/cryogen_core/sass.clj index 4ddb7cd..798f796 100644 --- a/src/cryogen_core/sass.clj +++ b/src/cryogen_core/sass.clj @@ -40,10 +40,9 @@ dest-sass base-dir]}] (shell/with-sh-dir base-dir - (sh "sass" - "--update" - (when (compass-installed?) "--compass") - (str src-sass ":" dest-sass)))) + (if (compass-installed?) + (sh "sass" "--compass" "--update" (str src-sass ":" dest-sass)) + (sh "sass" "--update" (str src-sass ":" dest-sass))))) (defn compile-sass->css! "Given a directory src-sass, looks for all sass files and compiles them into From c9828f6cc3e6d075f8a221424313f87c291f8f56 Mon Sep 17 00:00:00 2001 From: Ben Swift Date: Fri, 2 Dec 2016 14:36:25 +1100 Subject: [PATCH 3/3] nicer pretty-printing of "compiling sass" --- src/cryogen_core/sass.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cryogen_core/sass.clj b/src/cryogen_core/sass.clj index 798f796..8239e96 100644 --- a/src/cryogen_core/sass.clj +++ b/src/cryogen_core/sass.clj @@ -57,7 +57,7 @@ the command. Shows you any problems it comes across when compiling. " ;; I found sass files, ;; If sass is installed (do - (println "Compiling Sass Files:" src-sass dest-sass) + (println "\t" (cyan src-sass) "-->" (cyan dest-sass)) (let [result (compile-sass-file! opts)] (if (zero? (:exit result)) ;; no problems in sass compilation