Permalink
Browse files

Add an example for Runkit.

  • Loading branch information...
1 parent 7a0b894 commit a4cac257638dfbe53c1026636a1dad33a91c8364 @ben-eb committed Nov 25, 2016
Showing with 43 additions and 2 deletions.
  1. +2 −0 README.md
  2. +4 −2 package.json
  3. +37 −0 quickstart.js
View
@@ -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
View
@@ -91,7 +91,8 @@
"repository": "ben-eb/cssnano",
"files": [
"dist",
- "LICENSE-MIT"
+ "LICENSE-MIT",
+ "quickstart.js"
],
"nyc": {
"exclude": [
@@ -104,5 +105,6 @@
},
"eslintConfig": {
"extends": "cssnano"
- }
+ },
+ "tonicExampleFilename": "quickstart.js"
}
View
@@ -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.