wingsuit-designsystem / wingsuit

Twig for Storybook
GNU General Public License v2.0
91 stars 16 forks source link

feat(presets): add compression presets #176

Closed iuscare closed 3 years ago

iuscare commented 3 years ago

This preset adds compression for css, js and html files. Following props are exposed to be used in the wingsuit.config.yml

Prop Type Desc
gzipEnabled {boolean | default: true} use gzip compression algorithm/function
brotliEnabled {boolean | default: true} use brotli compression algorithm/function
fileName {string | default: '[path][base]'} target asset filename see for more information

Example configuration:

const namespaces = require('./source/default/namespaces');

module.exports = {
  presets: [
    '@wingsuit-designsystem/preset-tailwind2',
    '@wingsuit-designsystem/preset-postcss8',
    '@wingsuit-designsystem/preset-compression',
  ],
  parameters: {
    compression: {
      gzipEnabled: true,
      brotliEnabled: false,
    },
  },
  designSystems: {
    default: {
      namespaces,
    },
  },
};

The optimized files are only generated when running the build process of drupal.