Skip to content
Expansion plugin for CSS files
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Expansive plugin for CSS files.


The exp-css plugin provides build tooling for stylesheets. It provides the css.prefix service to automatically insert browser specific CSS prefixes, the css.render service to manage the generation HTML for stylesheets, and the minify-js service to minify script files for release distributions.


pak install exp-css


Provides the following transforms

  • css
  • css-prefix
  • css-minify
  • css-render
  • css-extract


The css service provides configuration control for the css transforms.


  • dotmin — Use '.min.css' as the output file extension after minification. Otherwise will be '.css'. Default to true.
  • enable — Enable the service. Defaults to true.
  • extract — Extract inline syltes into external stylesheet. Defaults to to false. Set to true to enable or set to a filename to contain all extracted styles.
  • files — List of stylesheets to manage. Defaults to [ '.css*', '!.map', '!.less' ].
  • force — Force minification even if a minified source file exists.
  • minify — Enable minifying of Javascript files. Default to false.
  • prefix — Autoprefix styles using vendor specific browser prefixes. Defaults to true.
  • usemap — Use minified stylesheet if corresponding source maps is present. Defaults to true.
  • usemin — Use minified stylesheet if present. Defaults to null. Set explicitly to false to disable the use of minified resources.



The css.prefix service processes CSS files to automatically add browser specific prefixes to CSS rules. It requires the autoprefixer utility.


The css.render service smartly selects supplied stylesheets. By default, it selects minified stylesheets if a corresponding source map file with a '' extension is present. Otherwise, non-minified stylesheets files with a plain 'css' extension will be selected.

The renderStyles API will generate the HTML for the page to include the specified stylesheets. The styles are taken from the current 'styles' collection for the page. Use 'addItems' and 'removeItems' to modify the styles collection.

The renderStyles API may be invoked with an argument can specify a set of patterns to select a subset of stylesheets for which to create link elements. This can be used to select or reject specific stylesheets. A second argument can supply an array of additional stylesheets to render.

    renderStyles(['!unwanted.css'], ['extra.css'])


The css.minify service optimizes stylesheets by minifying to remove white-space, managle names and otherwise compress the stylesheets. By default, the stylesheets use a '.css' extension, but will use a '.min.css' extension if the 'dotmin' option is enabled.


To support Content Security Policy headers, the css.extract service extracts inline styles into external Stylesheets. It will extract incline <style> elements and style attributes into a per-page external stylesheet file. If the extract attribute is set to a filename, then all the styles will be placed in that file.


The debug collection will be selected if the pak.json profile is set to debug. Similarly for the release collection.

debug: {
    services: {
        "css": {
            usemap: true

release: {
    services: {
        "css": {
            minify: true

Get Pak

You can’t perform that action at this time.