postcss-fs-css
v1.0.0
Published
A postcss-plugin for transforming your CSS to FirstSpirit compatible CSS
Downloads
2
Maintainers
Readme
Postcss FS CSS
A PostCSS-plugin transforming plain CSS to FirstSpirit compatible CSS
This plugin is highly inspired by the grunt-fscss plugin. It brings the functionality to PostCSS to integrate it within any workflow you like using PostCSS.
Setup
Install the plugin by typing npm install --save-dev postcss-fs-css
. After that you cann use the plugin like any other
PostCSS plugin.
Example:
const postcss = require('postcss');
postcss([
require('postcss-fs-css')()
]);
Within the function-call you can pass a configuration object.
Configuration
The configuration is fairly easy. There are three options in the configuration object:
abs
Here you can simply add a string which is passed in the CMS_REF
function as the abs
argument.
cacheStrategy
When configuring the plugin to use the revision
caching strategy there is a get-parameter with a FirstSpirit function
generating a revision-id added.
fileMapping
This option is an object specifying a mapping between the files and the reference IDs within FirstSpirit CMS. The key is
the name of the file, the value is either a string specifying the reference ID associated or an object with the reference
and the corresponding abs
.
Example:
const postcss = require('postcss');
postcss([
require('postcss-fs-css')({
'fonts/sample.woff': {
referenceName: 'sample_1',
abs: 'test'
}
})
]);