1
Vork 0
Rollup plugin to combine multi-file Svelte components
Go to file
Conduitry 515dfcc0af v2.0.0 2019-04-10 08:21:48 -04:00
CHANGELOG.md v2.0.0 2019-04-10 08:21:48 -04:00
LICENSE update readme 2018-12-10 21:54:06 -05:00
README.md update readme 2019-04-10 08:21:27 -04:00
index.js tidy 2019-04-10 08:17:29 -04:00
package.json v2.0.0 2019-04-10 08:21:48 -04:00

README.md

rollup-plugin-svelte-combiner

A simple Rollup plugin to allow the script and stylesheet portions of a Svelte component to be stored in separate files.

Requirements

  • Node 6+
  • Rollup 0.65+ or 1+

Installation

This is not published to npm. Install from Git tags.

Usage

Import svelteCombiner in your rollup.config.js. Place svelteCombiner() in your array of Rollup plugins before the main svelte plugin.

import svelte from 'rollup-plugin-svelte';
import svelteCombiner from 'rollup-plugin-svelte-combiner';

export default {
	// ...
	plugins: [
		// ...
		svelteCombiner(),
		svelte(),
		// ...
	],
};

The main file of a component is by default expected to have an .html or .svelte extension. This can be configured by initializing the plugin with svelteCombiner({ extensions: ['.something', '.another'] }). These should typically be set to the same extensions as are passed to the main svelte plugin.

The javascript portion of the component should have the same path and filename but with a .js extension. The stylesheet portion of the component should have the same path and filename but with a .css extension.

TODO

  • watch for new corresponding .js/.css files being added after Rollup watch starts (maybe?)

License

MIT