Provided fixes make cryogen work on Windows.
The path is converted to forward slash before further processed The executables for sass and compass are configurable, that's because on a Windows installation they are named sass.bat and compass.bat The default is still the Unix version.
This commit is contained in:
parent
ca2513f954
commit
998fc077e8
4 changed files with 23 additions and 13 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -7,4 +7,6 @@ pom.xml.asc
|
|||
*.class
|
||||
/.lein-*
|
||||
/.nrepl-port
|
||||
.DS*
|
||||
.DS*
|
||||
/.idea/
|
||||
/cryogen-core.iml
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(defproject cryogen-core "0.1.43"
|
||||
(defproject cryogen-core "0.1.44"
|
||||
:description "Cryogen's compiler"
|
||||
:url "https://github.com/cryogen-project/cryogen-core"
|
||||
:license {:name "Eclipse Public License"
|
||||
|
|
|
@ -85,7 +85,8 @@
|
|||
[^java.io.File page config markup]
|
||||
(with-open [rdr (java.io.PushbackReader. (reader page))]
|
||||
(let [re-root (re-pattern (str "^.*?(" (:page-root config) "|" (:post-root config) ")/"))
|
||||
page-name (s/replace (str page) re-root "")
|
||||
page-fwd (s/replace (str page) "\\" "/") ;; make it work on Windows
|
||||
page-name (s/replace page-fwd re-root "")
|
||||
file-name (s/replace page-name (re-pattern-from-ext (m/ext markup)) ".html")
|
||||
page-meta (read-page-meta page-name rdr)
|
||||
content ((m/render-fn markup) rdr config)]
|
||||
|
@ -434,6 +435,8 @@
|
|||
(update-in [:rss-filters] (fnil seq []))
|
||||
(update-in [:sass-src] (fnil str "css"))
|
||||
(update-in [:sass-dest] (fnil str "css"))
|
||||
(update-in [:sass-path] (fnil str "sass"))
|
||||
(update-in [:compass-path] (fnil str "compass"))
|
||||
(update-in [:post-date-format] (fnil str "yyyy-MM-dd"))
|
||||
(update-in [:keep-files] (fnil seq []))
|
||||
(update-in [:ignored-files] (fnil seq [#"^\.#.*" #".*\.swp$"])))]
|
||||
|
@ -448,7 +451,7 @@
|
|||
"Generates all the html and copies over resources specified in the config"
|
||||
[]
|
||||
(println (green "compiling assets..."))
|
||||
(let [{:keys [^String site-url blog-prefix rss-name recent-posts sass-src sass-dest keep-files ignored-files previews? author-root-uri] :as config} (read-config)
|
||||
(let [{:keys [^String site-url blog-prefix rss-name recent-posts sass-src sass-dest sass-path compass-path keep-files ignored-files previews? author-root-uri] :as config} (read-config)
|
||||
posts (add-prev-next (read-posts config))
|
||||
pages (add-prev-next (read-pages config))
|
||||
[navbar-pages sidebar-pages] (group-pages pages)
|
||||
|
@ -495,7 +498,9 @@
|
|||
(rss/make-filtered-channels config posts-by-tag)
|
||||
(println (blue "compiling sass"))
|
||||
(sass/compile-sass->css!
|
||||
{:src-sass sass-src
|
||||
{:path-sass sass-path
|
||||
:path-compass compass-path
|
||||
:src-sass sass-src
|
||||
:dest-sass (path ".." "public" blog-prefix sass-dest)
|
||||
:ignored-files ignored-files
|
||||
:base-dir "resources/templates/"})))
|
||||
|
|
|
@ -11,14 +11,14 @@
|
|||
|
||||
(defn sass-installed?
|
||||
"Checks for the installation of Sass."
|
||||
[]
|
||||
(= 0 (:exit (sh "sass" "--version"))))
|
||||
[path-sass]
|
||||
(= 0 (:exit (sh path-sass "--version"))))
|
||||
|
||||
(defn compass-installed?
|
||||
"Checks for the installation of Compass."
|
||||
[]
|
||||
[path-compass]
|
||||
(try
|
||||
(= 0 (:exit (sh "compass" "--version")))
|
||||
(= 0 (:exit (sh path-compass "--version")))
|
||||
(catch java.io.IOException _
|
||||
false)))
|
||||
|
||||
|
@ -38,11 +38,13 @@
|
|||
done by sh / launching the sass command."
|
||||
[{:keys [src-sass
|
||||
dest-sass
|
||||
path-sass
|
||||
path-compass
|
||||
base-dir]}]
|
||||
(shell/with-sh-dir base-dir
|
||||
(if (compass-installed?)
|
||||
(sh "sass" "--compass" "--update" (str src-sass ":" dest-sass))
|
||||
(sh "sass" "--update" (str src-sass ":" dest-sass)))))
|
||||
(if (compass-installed? path-compass)
|
||||
(sh path-sass "--compass" "--update" (str src-sass ":" dest-sass))
|
||||
(sh path-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
|
||||
|
@ -50,10 +52,11 @@ dest-sass. Prompts you to install sass if he finds sass files and can't find
|
|||
the command. Shows you any problems it comes across when compiling. "
|
||||
[{:keys [src-sass
|
||||
dest-sass
|
||||
path-sass
|
||||
ignored-files
|
||||
base-dir] :as opts}]
|
||||
(when-let [sass-files (seq (find-sass-files base-dir src-sass ignored-files))]
|
||||
(if (sass-installed?)
|
||||
(if (sass-installed? path-sass)
|
||||
;; I found sass files,
|
||||
;; If sass is installed
|
||||
(do
|
||||
|
|
Loading…
Reference in a new issue