0.36.0 • Published 4 years ago

@minna-ui/preprocess v0.36.0

Weekly downloads
80
License
Apache-2.0
Repository
github
Last release
4 years ago

NPM version Licence

@minna-ui/preprocess

Collection of Svelte preprocessors for use in Minna UI projects. It consists of a markup preprocessor which strips out excessive whitespace (collapses relevant whitespace down to a single space but leaves appropriate tags alone, e.g. <pre>, <script>, <style>) and a style preprocessor which runs styles through PostCSS.

Usage

Install:

yarn add @minna-ui/preprocess

Next add the preprocessor to your Svelte settings (e.g. in webpack.config.js or rollup.config.js).

If you want all our preprocessors use the all-in-one preset:

import { preprocess } from '@minna-ui/preprocess';

svelte({
  preprocess,
});

Or if you prefer, you can select the preprocessors individually:

import { markup, style } from '@minna-ui/preprocess';

svelte({
  preprocess: {
    markup: markup({
      // only use in production builds for better dev debugging
      enabled: process.env.NODE_ENV === 'production',
    }),
    style: style(),
  },
});

Utils

You can also strip whitespace from any HTML in a string template literal by using the html helper:

import { html } from '@minna-ui/preprocess';

const myMarkup = html`
  <div>
    <h1>My Title</h1>
  </div>
`;

console.log(myMarkup); // '<div><h1>My Title</h1></div>'

Tip: If you're using rollup with the setting treeshake.pureExternalModules = true (docs), prepend the call with a pure annotation so the module is tree shaken from the final JS bundle:

/*#__PURE__*/html`...`; // eslint-disable-line

Licence

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


© 2020 We Are Genki

0.36.1-next.57

4 years ago

0.36.0

4 years ago

0.35.2-next.58

4 years ago

0.35.2-next.35

4 years ago

0.35.2-next.30

4 years ago

0.35.2-next.31

4 years ago

0.36.0-next.24

4 years ago

0.35.0

4 years ago

0.34.0

5 years ago

0.33.0

5 years ago

0.32.0

5 years ago

0.31.0

5 years ago

0.30.0

5 years ago

0.29.0

5 years ago

0.28.0

5 years ago

0.27.0

5 years ago

0.26.0

5 years ago

0.25.0

5 years ago

0.24.0

5 years ago

0.23.0

5 years ago

0.22.2

5 years ago

0.22.1

5 years ago

0.22.1-beta.2

5 years ago

0.22.1-beta.1

5 years ago

0.22.1-beta.0

5 years ago

0.22.0-beta.0

5 years ago

0.22.0-next.23

5 years ago

0.22.0-next.20

5 years ago

0.22.0-next.12

5 years ago

0.22.0-next.332

5 years ago

0.22.0-next.331

5 years ago

0.22.0-next.325

5 years ago

0.22.0-next.307

5 years ago

0.22.0-next.298

5 years ago

0.22.0-next.288

5 years ago

0.22.0-next.274

5 years ago

0.22.0-next.266

5 years ago

0.22.0-next.265

5 years ago

0.22.0-next.262

5 years ago

0.22.0-next.260

5 years ago