Svelte preprocessor support for modular-css
. Process inline <style>
s or <link>
references inside your Svelte components using the full power of modular-css
while also providing compile-time optimizations for smaller bundles and even faster runtime performance!
Example
Turns this
Title
into what is effectively this
Title
while allowing you to use all of the usual modular-css
goodies.
Alternatively you can use <link href="./file.css" />
tags to reference CSS external to the component.
Install
$ npm i modular-css-svelte
Usage
svelte.preprocess()
const filename = "./Component.html"; const processor preprocess = // Processor options; const processed = await svelte; const result = processor; fs;
modular-css-rollup
API
const rollup = rollup; const preprocess processor = // Processor options; const bundle = await
rollup.config.js
const preprocess processor = // Processor options; moduleexports = input : "./Component.html" output : format : "es" file : "./dist/bundle.js" plugins : preprocess
Options
strict
If true
whenever a missing replacement is found like {css.doesnotexist}
an error will be throw aborting the file processing. Defaults to false
.
Shared Options
All options are passed to the underlying Processor
instance, see Options.