How to use the cssnano.process function in cssnano

To help you get started, we’ve selected a few cssnano examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github assetgraph / assetgraph / lib / assets / Css.js View on Github external
async minify() {
    try {
      const parseTree = this.parseTree.clone();
      const result = await cssnano.process(
        parseTree,
        { from: undefined, map: { annotation: false } }, // Tell postcss to not remove the sourceMappingURL comment
        {
          preset: [
            'default',
            {
              svgo: false,
              discardComments: {
                remove(comment) {
                  return !/@preserve|@license|[@#]\s*sourceURL|[#@]\s*sourceMappingURL|^!/.test(
                    comment
                  );
                }
              }
            }
          ]
github assetgraph / assetgraph / lib / assets / Css.js View on Github external
async minify() {
    try {
      const result = await cssnano.process(
        this.parseTree,
        { from: undefined, map: { annotation: false } }, // Tell postcss to not remove the sourceMappingURL comment
        {
          preset: [
            'default',
            {
              svgo: false,
              discardComments: {
                remove(comment) {
                  return !/@preserve|@license|[@#]\s*sourceURL|[#@]\s*sourceMappingURL|^!/.test(
                    comment
                  );
                }
              }
            }
          ]
github sx1989827 / DOClever / Client / node_modules / cssnano / quickstart.js View on Github external
* 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);
});
github QingWei-Li / vuep / build / build-css.js View on Github external
.then(function (result) {
    save(file, result.css)
    console.log('salad - ' + file)
    cssnano(loadDist(file))
      .then(function (result) {
        save('vuep.min.css', result.css)
        console.log('cssnao - vuep.min.css')
      })
  }).catch(function (err) {
    console.log(err)
github docsifyjs / docsify / build / build-css.js View on Github external
.then(function (result) {
      save(file, result.css)
      console.log('salad - ' + file)
      isProd &&
        cssnano(loadLib(file)).then(function (result) {
          saveMin(file, result.css)
          console.log('cssnao - ' + file)
        })
    })
    .catch(function (err) {
github soluml / pre-style / src / module / normalize.js View on Github external
module.exports = function Normalize(cssObj) {
  return CSSNano.process(
    cssObj.toString(),
    {
      preset: 'advanced',
      from: 'undefined'
    },
    { //CSS Nano Config -> http://cssnano.co/optimisations/
      autoprefixer: false,
      calc: true,
      colormin: true,
      convertValues: true,
      core: true,
      discardDuplicates: true,
      discardEmpty: true,
      discardOverridden: true,
      discardUnused: false,
      filterOptimiser: true,
github ezekielchentnik / preact-pwa / build.js View on Github external
  .then((purified) => cssnano(purified, { autoprefixer: { add: true } }))
  .then(({ css }) => fs.outputFileAsync(`build/public/bundle.css`, css))
github romainberger / webpack-rtl-plugin / src / index.js View on Github external
cssnanoPromise = cssnanoPromise.then(() => {
              let minify = cssnano.process( baseSource, nanoOptions).then(output => {
                compilation.assets[asset] = new ConcatSource(output.css)
              });

              if (match) {
                const rtlMinify = cssnano.process(rtlSource, nanoOptions).then(output => {
                  compilation.assets[filename] = new ConcatSource(output.css)
                  rtlFiles.push(filename)
                });

                minify = Promise.all([minify, rtlMinify]);
              }

              return minify;
            })
          }

cssnano

A modular minifier, built on top of the PostCSS ecosystem.

MIT
Latest version published 12 days ago

Package Health Score

97 / 100
Full package analysis