Boot task for autoprefixer.
Autoprefixer utilizes the most recent data from Can I Use to add only necessary vendor prefixes.
Make sure postcss-cli and autoprefixer are installed on your system.
npm install --global postcss-cli autoprefixer
In build.boot, import the autoprefixer task:
(set-env! :dependencies '[[danielsz/boot-autoprefixer "x.x.x"]]) ; latest release is indicated above
(require '[danielsz.autoprefixer :refer [autoprefixer]])
The autoprefixer task takes a vector of filenames, the CSS files you want to post-process with autoprefixer.
(task-options! autoprefixer {:files ["style-1.css" "style-2.css"]})
Autoprefixer uses Browserslist, so you can specify the browsers you
want to target in your project by queries like last 2 versions
or > 5%
(task-options! autoprefixer {:files ["style-1.css" "style-2.css"]
:browsers "last 2 versions"})
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.
(comp
(cljs :source-map true)
(autoprefixer :files ["style-1.css" "style-2.css"]
:browsers "last 2 versions"))