summaryrefslogtreecommitdiff
path: root/src/stylesheets/postcss.config.js
blob: d40c4c46f0ab18c6ef67c87e1c12ebdbc0d1e9dd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
'use strict'

module.exports = (ctx) => ({
  plugins: {
    autoprefixer: true,
    cssnano: {
      // refer to https://cssnano.co/docs/optimisations to understand this preset
      preset: [
        'default',
        {
          discardComments: { exclude: true }, // comments are currently aimed at the user, so keep them
          minifySelectors: { exclude: true }, // replaced by ./lib/postcss-minify-selectors.js
          minifyFontValues: { exclude: true }, // switches to numeric font weights, which make the stylesheet less extensible
          mergeRules: { exclude: true }, // TODO reenable; currently causes non-functional differences in output
          uniqueSelectors: { exclude: true }, // reorders selectors, which doesn't improve minification
          cssDeclarationSorter: { exclude: true }, // reorders properties, which doesn't improve minification
        },
      ]
    },
    [require.resolve('./lib/postcss-minify-selectors.js')]: true,
    [require.resolve('./lib/postcss-rule-per-line.js')]: true,
  }
})