-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This task uses npm in order to install and launch the lessc compiler against the input .less file. The output will be included into the fileset by default. At the moment only the --include-dirs option is handled and passed to lessc.
- Loading branch information
1 parent
60331bf
commit d0d8776
Showing
4 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
BOOT_VERSION=2.7.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
(set-env! :dependencies '[[org.clojure/clojure "1.8.0" :scope "provided"] | ||
[degree9/boot-npm "1.7.0-SNAPSHOT"] | ||
[adzerk/bootlaces "0.1.13" :scope "test"] | ||
[degree9/boot-semver "1.6.0" :scope "test"]] | ||
:resource-paths #{"src"}) | ||
|
||
(require '[degree9.boot-semver :refer :all]) | ||
|
||
(task-options! | ||
pom {:project 'degree9/boot-css | ||
:description "CSS Preprocessors for boot-clj." | ||
:url "https://github.com/degree9/boot-exec" | ||
:scm {:url "https://github.com/degree9/boot-exec"}}) | ||
|
||
(deftask develop | ||
"Build boot-css for development." | ||
[] | ||
(comp | ||
(version :develop true | ||
:minor 'inc | ||
:patch 'zero | ||
:pre-release 'snapshot) | ||
(watch) | ||
(target) | ||
(build-jar))) | ||
|
||
(deftask deploy | ||
"Build boot-css and deploy to clojars." | ||
[] | ||
(comp | ||
(version) | ||
(target) | ||
(build-jar) | ||
(push-release))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
(ns degree9.boot-css | ||
(:require [boot.core :as boot] | ||
[clojure.string :as str] | ||
[clojure.java.io :as io] | ||
[boot.util :as u] | ||
[degree9.boot-npm :as npm])) | ||
|
||
(boot/deftask lessc | ||
"Compile CSS using the npm version of Less." | ||
[l less-path PATH str "Path to the .less file to compile (relative to the fileset)." | ||
i include-dirs PATH #{str} "Include directories for lessc."] | ||
(let [tmp (boot/tmp-dir!)] | ||
(boot/with-pre-wrap [fs] | ||
(let [less-tmp (boot/tmp-get fs less-path)] | ||
(assert less-tmp (format "Less-path (%s) should point to a file in the classpath." less-path)) | ||
(let [compiled-file (io/file tmp (str/replace less-path #"\.less$" ".css")) | ||
include-dirs (->> [(boot/tmp-dir less-tmp)] | ||
(into (or include-dirs #{})) | ||
(str/join ":")) | ||
mw (npm/exec :module "less" | ||
:process "lessc" | ||
:arguments [(str "--include-path=" include-dirs) | ||
(-> less-tmp boot/tmp-file .getAbsolutePath) | ||
(.getAbsolutePath compiled-file)])] | ||
(u/dbug* "Less boot dir: %s\n" (boot/tmp-dir less-tmp)) | ||
(u/dbug* "Less boot file: %s\n" (-> less-tmp boot/tmp-file .getAbsolutePath)) | ||
(u/dbug* "Less boot target: %s\n" (.getAbsolutePath compiled-file)) | ||
|
||
((mw identity) fs) ;; only for side effects on tmp folder | ||
(-> fs (boot/add-resource tmp) boot/commit!)))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#Mon May 01 18:58:18 MDT 2017 | ||
VERSION=1.0.0 |