accessdigital / wilson

A Drupal installation profile produced by Access. New installations should use https://github.com/accessdigital/drupal-template
https://www.weareaccess.co.uk
4 stars 1 forks source link

Adding a dedicated gulp build:dist task that purges Tailwind CSS on demand #13

Closed AccessPaul closed 2 years ago

AccessPaul commented 2 years ago

Originally I had Tailwind purge enabled all the time but this can sometimes get in the way when doing rapid development locally. So this PR introduces distinct build tasks for local development (no purging) and production/CI (with purging). This works by toggling on and off a NODE_ENV flag that is used by Tailwind.

Going forward, use gulp build if you want a complete Tailwind CSS file and gulp build:dist for a much much smaller purged CSS file.

Remember to add specific paths to the following section of tailwind.config.js if you want them to be included in the purging process (e.g. the source files of a react app or a custom module that introduces additional templates).

purge: {
    content: [
      './templates/**/*.html.twig',
      './scripts/**/*.js',
      './*.theme',
    ]
    ...