metalsmith-svelte

Svelte plugin for Metalsmith

Installation

Use npm.

npm install --save-dev metalsmith-svelte

Usage

CLI

Add the metalsmith-svelte field to your metalsmith.json.

{
  "plugins": {
    "metalsmith-svelte": {
      "name": "MyComponent",
      "sourceMap": "inline"
    }
  }
}

API

const Metalsmith = require('metalsmith');
const svelte = require('metalsmith-svelte');

new Metalsmith('./source')
.use(svelte({
  sourceMap: true
}))
.build((err, files) => {
  if (err) {
    throw err;
  }

  console.log('Completed.');
});

Options

Svelte compiler options are available except for:

  • filename option is not supported and will be automatically set.
  • onerror option is not supported as there is no value to use it.

In addition the following option is supported:

options.sourceMap

Value: true, false or 'inline'
Default: false

  • true generates a separate source map file with .map extension, for exmaple index.js.map along with index.js.
  • 'inline' appends an inline source map to the transformed file.

License

ISC License © 2017 - 2018 Shinnosuke Watanabe

Top categories

Loading Svelte Themes