Skip to content

Commit

Permalink
Add an example for Runkit.
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-eb committed Nov 25, 2016
1 parent 7a0b894 commit a4cac25
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -28,6 +28,8 @@ For further details check out the [website](http://cssnano.co/):
* [Full list of optimisations](http://cssnano.co/optimisations/).
* [Customise the output (options documentation)](http://cssnano.co/options/).

You can now [try cssnano online](https://runkit.com/npm/cssnano) via Runkit!


## Contributing

Expand Down
6 changes: 4 additions & 2 deletions package.json
Expand Up @@ -91,7 +91,8 @@
"repository": "ben-eb/cssnano",
"files": [
"dist",
"LICENSE-MIT"
"LICENSE-MIT",
"quickstart.js"
],
"nyc": {
"exclude": [
Expand All @@ -104,5 +105,6 @@
},
"eslintConfig": {
"extends": "cssnano"
}
},
"tonicExampleFilename": "quickstart.js"
}
37 changes: 37 additions & 0 deletions quickstart.js
@@ -0,0 +1,37 @@
/*
* This example targets Node 4 and up.
*/

const cssnano = require('cssnano');

/*
* Add your CSS code here.
*/

const css = `
h1 {
color: #ff0000;
font-weight: bold;
}
`;

/*
* Add your configuration here; see http://cssnano.co/options/ and
* http://cssnano.co/optimisations/ for more details.
*
* For example you can turn off z-index rebasing by setting `zindex: false`
* in your config, or you can use `safe: true` which will turn off unsafe
* optimisations.
*/

const opts = {

};

/*
* Compress the CSS asynchronously and log it to the console.
*/

cssnano.process(css, opts).then(result => {
console.log(result.css);
});

0 comments on commit a4cac25

Please sign in to comment.