svelte-global-styles Svelte Themes

Svelte Global Styles

svelte-global-styles

Plugin for make styles in svelte-components global again

Instalation

npm install --save-dev svelte-global-styles

or

npm i -D HeadMad/svelte-global-styles

Usage

// rollup.config.js

import svelte from 'rollup-plugin-svelte';
import globalStyles from 'svelte-global-styles';
...

export default {
  ...
  plugins: [
    svelte({
      preprocess: [
        globalStyles
      ],
      ...
    })
  ]
}

Scope some styles

If you whant use scoped styles in som files,
just add attribute scoped to tag <style>

<style scoped>
  /* Scoped styles */
</style>

Also

If you don't planing use scope styles, you can use postcss plugin
called postcss-svelte-global-styles. But for this, you must use svelte plugin
like svelte-postcss

License

MIT

Top categories

Loading Svelte Themes