quickstart.js 654 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * This example targets Node 4 and up.
  3. */
  4. const cssnano = require('cssnano');
  5. /*
  6. * Add your CSS code here.
  7. */
  8. const css = `
  9. h1 {
  10. color: #ff0000;
  11. font-weight: bold;
  12. }
  13. `;
  14. /*
  15. * Add your configuration here; see http://cssnano.co/options/ and
  16. * http://cssnano.co/optimisations/ for more details.
  17. *
  18. * For example you can turn off z-index rebasing by setting `zindex: false`
  19. * in your config, or you can use `safe: true` which will turn off unsafe
  20. * optimisations.
  21. */
  22. const opts = {
  23. };
  24. /*
  25. * Compress the CSS asynchronously and log it to the console.
  26. */
  27. cssnano.process(css, opts).then(result => {
  28. console.log(result.css);
  29. });