SUI-Components / sui

Monorepo for SUI (Simple User Interface) packages.
169 stars 33 forks source link

feat(packages/sui-bundler): add flag for creating libs with css chunks #1738

Open NietoGX opened 6 months ago

NietoGX commented 6 months ago

Description

This PR adds an option to the sui-bundler build lib for generating CSS chunks.

By default the code will not use chunks for the css. With the option --chunk-css will use the css with chunks.

Example

sui-bundler lib umd/index.js -o umd/ --root --chunk-css will generate a chunk for each css file. For example, if we want to select a different scss file from the js with code like:

switch (site) {
    case 'fotocasa':
      import('./fotocasa.scss')
      break
    case 'cochesnet':
      import('./motor.scss')
      break
    case 'motosnet':
      import('./motor.scss')
      break
    case 'milanuncios':
      import('./milanuncios.scss')
      break
    case 'infojobs':
      import('./milanuncios.scss')
      break
    default:
      import('./index.scss')
  }

The sui-bundler will generate the next files:

image