0.16.0 • Published 6 years ago

@minna-ui/svelte-preprocess-markup v0.16.0

Weekly downloads
2
License
Apache-2.0
Repository
github
Last release
6 years ago

NPM version Licence

@minna-ui/svelte-preprocess-markup

Svelte markup preprocessor for use in Minna UI projects. Optimise HTML before it hits Svelte for smaller output. Primarily this trim excessive whitespace but you can enable the unsafe option for advanced optimisations.

Usage

Install:

yarn add -D @minna-ui/svelte-preprocess-markup

Add to your Svelte compile options:

const preprocessMarkup = require('@minna-ui/svelte-preprocess-markup');

const isProd = process.env.NODE_ENV === 'production';

svelte({
  preprocess: {
    // only remove whitespace in production for better feedback during development
    ...(isProd ? { markup: preprocessMarkup() } : {}),
  },
}),

Known issues

You must wrap {} tags in quotes when there are { or } characters inside the tag. The exception to this is when using spread attributes (e.g. {...child.props}) in which case you must not use quotes.

Incorrect:

<MinnaNavbar segment={child.segment} menuItems={[
  { url: 'example', name: 'Example' },
]}/>

Correct (with " around { }):

<MinnaNavbar segment="{child.segment}" menuItems="{[
  { url: 'example', name: 'Example' },
]}"/>

Options

NameDefaultTypeDescription
unsafeWhitespacefalseBooleanCollapse all whitespace between tags (instead of leaving a single space). When using this option you may need to manually add spaces, {' '}, around inline elements such as links.
unsafefalseBooleanEnable aggressive and potentially dangerous optimisations.
*undefinedAnyAny other options you pass in will override the default html-minifier options. See the html-minifier docs for more info.

Licence

@minna-ui/svelte-preprocess-markup is part of Minna UI, an Apache-2.0 licensed open source project. See LICENCE.


© 2018 We Are Genki

0.16.0

6 years ago

0.15.0

6 years ago

0.13.0

6 years ago

0.12.0

6 years ago

0.11.0

6 years ago

0.10.0

6 years ago

0.9.0

6 years ago

0.8.0

6 years ago

0.7.0

6 years ago

0.5.0

6 years ago

0.4.0

6 years ago

0.3.0

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago

0.0.0

6 years ago