@firstfleet/sveltejs-brunch

2.0.2 • Public • Published

sveltejs-brunch

Forked from sveltejs-brunch. May include additional changes, newer versions of dependencies, and/or bug fixes that are not in the upstream repo. Changes will be submitted via pull request.

WARNING! Version 2.0.0 or > has been converted from CJS to ESM. If you want to use this plugin you will need to use it in conjunction with @firstfleet/brunch. @firstfleet/brunch is a fork of the most recent version of brunch, but has been modified to support both CJS and ESM brunch plugins.

Compile Svelte 3 components inside Brunch projects.

  • Extract the CSS into a separate file
  • Support CSS & JS Sourcemaps
  • Preprocessing of markup, style, script
  • Define file extensions which should be compiled
  • Pass any Svelte compiler option

Installation

npm install --save-dev @firstfleet/sveltejs-brunch

By default all *.svelte.html, .svelte files are compiled, unless you use the pattern option.

Advanced usage

module.exports.plugins = {
  sveltejs: {
    // To extract the CSS into files, simply include to extractCSS option in your Brunch config like so...
    extractCSS: true,
    // To combine the sourcemaps from all components into one
    combineSourceMapCSS: true,
    // The generated combined css file
    out: './public/components.css',
    // By default, svelte, svelte.html are used.
    pattern: /\.(svelte|html)$/
    // Optionally, preprocess components with svelte.preprocess:
    // https://github.com/sveltejs/svelte#preprocessor-options
    preprocess: {
      style: ({ content }) => {
        return transformStyles(content)
      }
    },
    // Other compiler options https://github.com/sveltejs/svelte#compiler-options
    ...
  }
}

Current list of deviations from origional sveltejs-brunch repo

  1. Bug fix for sourcemap generation in brunch PR
  2. Bug fix for svelte preprocessor. The preprocessor call was not correctly passing through the filename to the preprocessor plugin.
  3. Has been converted to ESM (ES Module) to work in conjunction with @firstfleet/brunch

Readme

Keywords

Package Sidebar

Install

npm i @firstfleet/sveltejs-brunch

Weekly Downloads

10

Version

2.0.2

License

ISC

Unpacked Size

45.6 kB

Total Files

10

Last publish

Collaborators

  • nathanbelete
  • dwhitak
  • spies36
  • brbeaird
  • grantdaddy
  • jxpatto