README.org

August 15, 2016 ยท View on GitHub

  • Boot-autoprefixer

Boot task for [[https://github.com/postcss/autoprefixer][autoprefixer]].

#+BEGIN_QUOTE Autoprefixer utilizes the most recent data from Can I Use to add only necessary vendor prefixes. #+END_QUOTE

** Requirements

Make sure postcss-cli and autoprefixer are installed on your system. #+BEGIN_SRC clojure npm install --global postcss-cli autoprefixer #+END_SRC

** Installation

[[https://clojars.org/danielsz/boot-autoprefixer][https://img.shields.io/clojars/v/danielsz/boot-autoprefixer.svg]]

** Usage

In build.boot, import the autoprefixer task:

#+BEGIN_SRC clojure (set-env! :dependencies '[[danielsz/boot-autoprefixer "x.x.x"]]) ; latest release is indicated above (require '[danielsz.autoprefixer :refer [autoprefixer]]) #+END_SRC

The autoprefixer task takes a vector of filenames, the CSS files you want to post-process with autoprefixer.

#+BEGIN_SRC clojure (task-options! autoprefixer {:files ["style-1.css" "style-2.css"]}) #+END_SRC

Autoprefixer uses [[https://github.com/ai/browserslist][Browserslist]], so you can specify the browsers you want to target in your project by queries like =last 2 versions= or => 5%=

#+BEGIN_SRC clojure (task-options! autoprefixer {:files ["style-1.css" "style-2.css"] :browsers "last 2 versions"}) #+END_SRC

You can now compose autoprefixer in your boot pipeline like any other task.

An alternate way of going about this is to forgo task-options! and instead use keyword arguments.

#+BEGIN_SRC clojure (comp (cljs :source-map true) (autoprefixer :files ["style-1.css" "style-2.css"] :browsers "last 2 versions")) #+END_SRC