danielsz / boot-autoprefixer

Boot task for css autoprefixer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Boot-autoprefixer

Boot task for autoprefixer.

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

Requirements

Make sure postcss-cli and autoprefixer are installed on your system.

npm install --global postcss-cli autoprefixer

Installation

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

Usage

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"))

About

Boot task for css autoprefixer


Languages

Language:Clojure 100.0%