sfcode An Online Competing and Development Environment

cssnano-preset-default

> Safe defaults for cssnano which require minimal configuration.

# Table of Contents

- Overview
- Usage
  - Install
  - Configuration
- Plugins
  - cssnano-util-raw-cache
  - postcss-calc (external)
  - postcss-colormin
  - postcss-convert-values
  - postcss-discard-comments
  - postcss-discard-duplicates
  - postcss-discard-empty
  - postcss-discard-overridden
  - postcss-merge-longhand
  - postcss-merge-rules
  - postcss-minify-font-values
  - postcss-minify-gradients
  - postcss-minify-params
  - postcss-minify-selectors
  - postcss-normalize-charset
  - postcss-normalize-display-values
  - postcss-normalize-positions
  - postcss-normalize-repeat-style
  - postcss-normalize-string
  - postcss-normalize-timing-functions
  - postcss-normalize-unicode
  - postcss-normalize-url
  - postcss-normalize-whitespace
  - postcss-ordered-values
  - postcss-reduce-initial
  - postcss-reduce-transforms
  - postcss-svgo
  - postcss-unique-selectors
- Contributors
- License

# Overview

This default preset for cssnano only includes transforms that make no assumptions about your CSS other than what is passed in. In previous iterations of cssnano, assumptions were made about your CSS which caused output to look different in certain use cases, but not others. These transforms have been moved from the defaults to other presets, to make this preset require only minimal configuration.

# Usage

## Install

Note that this preset comes bundled with cssnano by default, so you don't need to install it separately.

## Configuration

If you would like to use the default configuration, then you don't need to add anything to your `package.json`.

But should you wish to customise this, you can pass an array with the second parameter as the options object to use. For example, to remove all comments:

{
"name": "awesome-application",
+ "cssnano": {
+ "preset": [
+ "default",
+ {"discardComments": {"removeAll": true}}
+ ]
+ }
}

Depending on your usage, the JSON configuration might not work for you, such as in cases where you would like to use options with customisable function parameters. For this use case, we recommend a `cssnano.config.js` at the same location as your `package.json`. You can then load a preset and export it with your custom parameters:

const defaultPreset = require('cssnano-preset-default');
module.exports = defaultPreset({
discardComments: {
remove: comment => comment[0] === "@"
}
});

Note that you may wish to publish your own preset to npm for reusability, should it differ a lot from this one. This is highly encouraged!

# Plugins

## <a href="https://github.com/Siilwyn/css-declaration-sorter"><tt>css-declaration-sorter</tt></a> (external)

> Sorts CSS declarations fast and automatically in a certain order.

This plugin is loaded with its default configuration.

## <a href="https://github.com/cssnano/cssnano/tree/master/packages/cssnano-util-raw-cache"><tt>cssnano-util-raw-cache</tt></a>

> Manages the raw value formatting for generated AST nodes.

This plugin is loaded with its default configuration.

## <a href="https://github.com/postcss/postcss-calc"><tt>postcss-calc</tt></a> (external)

> PostCSS plugin to reduce calc()

This plugin is loaded with its default configuration.

## <a href="https://github.com/cssnano/cssnano/tree/master/packages/postcss-colormin"><tt>postcss-colormin</tt></a>

> Minify colors in your CSS files with PostCSS.

This plugin is loaded with its default configuration.

## <a href="https://github.com/cssnano/cssnano/tree/master/packages/postcss-convert-values"><tt>postcss-convert-values</tt></a>

> Convert values with PostCSS (e.g. ms -> s)

This plugin is loaded with the following configuration:

{
length: false
}

## <a href="https://github.com/cssnano/cssnano/tree/master/packages/postcss-discard-comments"><tt>postcss-discard-comments</tt></a>

> Discard comments in your CSS files with PostCSS.

This plugin is loaded with its default configuration.

## <a href="https://github.com/cssnano/cssnano/tree/master/packages/postcss-discard-duplicates"><tt>postcss-discard-duplicates</tt></a>

> Discard duplicate rules in your CSS files with PostCSS.

This plugin is loaded with its default configuration.

## <a href="https://github.com/cssnano/cssnano/tree/master/packages/postcss-discard-empty"><tt>postcss-discard-empty</tt></a>

> Discard empty rules and values with PostCSS.

This plugin is loaded with its default configuration.

## <a href="https://github.com/cssnano/cssnano/tree/master/packages/postcss-discard-overridden"><tt>postcss-discard-overridden</tt></a>

> PostCSS plugin to discard overridden @keyframes or @counter-style.

This plugin is loaded with its default configuration.

## <a href="https://github.com/cssnano/cssnano/tree/master/packages/postcss-merge-longhand"><tt>postcss-merge-longhand</tt></a>

> Merge longhand properties into shorthand with PostCSS.

This plugin is loaded with its default configuration.

## <a href="https://github.com/cssnano/cssnano/tree/master/packages/postcss-merge-rules"><tt>postcss-merge-rules</tt></a>

> Merge CSS rules with PostCSS.

This plugin is loaded with its default configuration.

## <a href="https://github.com/cssnano/cssnano/tree/master/packages/postcss-minify-font-values"><tt>postcss-minify-font-values</tt></a>

> Minify font declarations with PostCSS

This plugin is loaded with its default configuration.

## <a href="https://github.com/cssnano/cssnano/tree/master/packages/postcss-minify-gradients"><tt>postcss-minify-gradients</tt></a>

> Minify gradient parameters with PostCSS.

This plugin is loaded with its default configuration.

## <a href="https://github.com/cssnano/cssnano/tree/master/packages/postcss-minify-params"><tt>postcss-minify-params</tt></a>

> Minify at-rule params with PostCSS

This plugin is loaded with its default configuration.

## <a href="https://github.com/cssnano/cssnano/tree/master/packages/postcss-minify-selectors"><tt>postcss-minify-selectors</tt></a>

> Minify selectors with PostCSS.

This plugin is loaded with its default configuration.

## <a href="https://github.com/cssnano/cssnano/tree/master/packages/postcss-normalize-charset"><tt>postcss-normalize-charset</tt></a>

> Add necessary or remove extra charset with PostCSS

This plugin is loaded with the following configuration:

{
add: false
}

## <a href="https://github.com/cssnano/cssnano/tree/master/packages/postcss-normalize-display-values"><tt>postcss-normalize-display-values</tt></a>

> Normalize multiple value display syntaxes into single values.

This plugin is loaded with its default configuration.

## <a href="https://github.com/cssnano/cssnano/tree/master/packages/postcss-normalize-positions"><tt>postcss-normalize-positions</tt></a>

> Normalize keyword values for position into length values.

This plugin is loaded with its default configuration.

## <a href="https://github.com/cssnano/cssnano/tree/master/packages/postcss-normalize-repeat-style"><tt>postcss-normalize-repeat-style</tt></a>

> Convert two value syntax for repeat-style into one value.

This plugin is loaded with its default configuration.

## <a href="https://github.com/cssnano/cssnano/tree/master/packages/postcss-normalize-string"><tt>postcss-normalize-string</tt></a>

> Normalize wrapping quotes for CSS string literals.

This plugin is loaded with its default configuration.

## <a href="https://github.com/cssnano/cssnano/tree/master/packages/postcss-normalize-timing-functions"><tt>postcss-normalize-timing-functions</tt></a>

> Normalize CSS animation/transition timing functions.

This plugin is loaded with its default configuration.

## <a href="https://github.com/cssnano/cssnano/tree/master/packages/postcss-normalize-unicode"><tt>postcss-normalize-unicode</tt></a>

> Normalize unicode-range descriptors, and can convert to wildcard ranges.

This plugin is loaded with its default configuration.

## <a href="https://github.com/cssnano/cssnano/tree/master/packages/postcss-normalize-url"><tt>postcss-normalize-url</tt></a>

> Normalize URLs with PostCSS

This plugin is loaded with its default configuration.

## <a href="https://github.com/cssnano/cssnano/tree/master/packages/postcss-normalize-whitespace"><tt>postcss-normalize-whitespace</tt></a>

> Trim whitespace inside and around CSS rules & declarations.

This plugin is loaded with its default configuration.

## <a href="https://github.com/cssnano/cssnano/tree/master/packages/postcss-ordered-values"><tt>postcss-ordered-values</tt></a>

> Ensure values are ordered consistently in your CSS.

This plugin is loaded with its default configuration.

## <a href="https://github.com/cssnano/cssnano/tree/master/packages/postcss-reduce-initial"><tt>postcss-reduce-initial</tt></a>

> Reduce initial definitions to the actual initial value, where possible.

This plugin is loaded with its default configuration.

## <a href="https://github.com/cssnano/cssnano/tree/master/packages/postcss-reduce-transforms"><tt>postcss-reduce-transforms</tt></a>

> Reduce transform functions with PostCSS.

This plugin is loaded with its default configuration.

## <a href="https://github.com/cssnano/cssnano/tree/master/packages/postcss-svgo"><tt>postcss-svgo</tt></a>

> Optimise inline SVG with PostCSS.

This plugin is loaded with its default configuration.

## <a href="https://github.com/cssnano/cssnano/tree/master/packages/postcss-unique-selectors"><tt>postcss-unique-selectors</tt></a>

> Ensure CSS selectors are unique.

This plugin is loaded with its default configuration.

# Contributors

See CONTRIBUTORS.md.

# License

MIT © Ben Briggs