3.0.2 • Published 1 year ago

@flemist/rollup-plugin-css-chunks v3.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

rollup-plugin-css-chunks

Rollup plugin to extract imported CSS files as chunks, allowing code split of CSS stylesheets. Use rollup-plugin-extract-bundle-tree to extract dependencies between JS and CSS chunks.

Installation

npm install --save-dev rollup-plugin-css-chunks

Features

  • Split CSS in chunks;
  • Load CSS map referenced or embedded on sourceMappingURL;
  • Return CSS chunk public URL;

Usage

import css_chunk_url from './home.css';

const css_chunk_map_url = css_chunk_url + '.map';
console.log({css_chunk_url, css_chunk_map_url})

Configuration

// rollup.config.js
import css from 'rollup-plugin-css-chunks';

export default {
    input: 'src/main.js',
    output: {
        dir: 'public',
        format: 'esm'
    },
    plugins: [
        css({
            // inject a CSS `@import` directive for each chunk depended on
            injectImports: false,
            // name pattern for emitted secondary chunks
            chunkFileNames: '[name]-[hash].css',
            // name pattern for emitted entry chunks
            entryFileNames: '[name].css',
            // public base path of the files
            publicPath: '',
            // generate sourcemap
            sourcemap: false,
            // emit css/map files
            emitFiles: true,
        })
    ]
}

License

MIT

3.0.2

1 year ago

3.0.1

2 years ago

3.0.0

2 years ago

2.0.5

2 years ago

2.0.7

2 years ago

2.0.6

2 years ago

2.0.9

2 years ago

2.0.10

2 years ago

2.0.8

2 years ago

2.0.4

2 years ago

2.0.3

3 years ago