0.2.9 • Published 8 years ago
csspresso v0.2.9
csspresso
prefixless without the DSL.
Batteries included
- dupeless inline imports: postcss-import
- automagic vendor prefixes: autoprefixer
- variables (and other new language features): postcss-cssnext
- minification: cssnano
- source maps
FAQ
- Question: How do I add my indispensable, favourite Less/Myth/Sass/Stylus/etc feature x?
- Answer: Take a good, hard look at your first revision and just say to yourself, "gloves."
Status
You're feeling very, very lucky.
Installation
$ npm install csspresso
Configuration
{Array} browsers
- default value:
['last 2 versions']
- cf. browserlist queries
- default value:
{string} map
- default value:
.map
appended to the file's base name - optional pattern to customize the source map file name;
the source map file is always a sibling of the target file
- backreferences:
$1
: file base name without extension$2
: file extension
- example:
- base file name:
foo.css
- map option value:
$1-$2-map.json
- map file name:
foo-css-map.json
- base file name:
- backreferences:
- default value:
{string} source
- default value:
./source/style
- all CSS files that match
*.css
in this directory generate output files; includes must be in sub-directories
- default value:
{string} target
- default value:
./public/style
- default value:
CLI usage
package.json
config.csspresso
values (if any) are merged with the default values.
{
"config": {
"csspresso": {
"browsers": [
"any browserlist query"
],
"source": "path/to/source",
"target": "path/to/target"
}
},
"scripts": {
"build": "csspresso",
"develop": "csspresso watch"
}
}
Terminal
$ npm run build
or
$ npm run develop
Programmatic usage
var csspresso = require('csspresso');
var options = {
browsers: [
'any browserlist query'
],
source: 'path/to/source',
source: 'path/to/target'
}
csspresso(options)
.then(function () {
// do something after csspresso is done
});
- if
options
is provided- all options must be set
- else
- if csspresso is invoked by a script that is executed with
npm run
- configuration is resolved as with CLI usage
- else the defaults are used
- if csspresso is invoked by a script that is executed with
With programmatic usage, watching is not an option (pun intended).
License
MIT