Publishing

npm

If you set up an environment via the create-minze CLI, you can publish your components to npm in two simple steps.

1. Build

This command creates a dist directory with an es build, a CDN build and Type Declarations (If you selected the TypeScript template).

# npm
$ npm run build

# yarn
$ yarn build

# pnpm
$ pnpm run build

2. Publish

$ npm publish

TIP

This is a default npm command refer to the npm docs for more information.

Using

To use your package in a project simply install minze plus your package.

Let's assume you published your library under the name my-awesome-package

npm

$ npm install minze my-awesome-package
import Minze from 'minze'
import { MyAwesomeElement, MyAwesomeElementTwo } from 'my-awesome-package'

Minze.defineAll([MyAwesomeElement, MyAwesomeElementTwo])
<my-awesome-element></my-awesome-element>
<my-awesome-element-two></my-awesome-element-two>

CDN

If you have published your package to npm, you can also load it via a CDN link from unpkg or jsdelivr. Pick one of the following:

unpkg

jsdelivr

Example

<html>
  <head></head>
  <body>
    <!-- custom components -->
    <my-awesome-element></my-awesome-element>
    <my-awesome-element-two></my-awesome-element-two>

    <!-- cdn link -->
    <script src="//unpkg.com/[email protected]" defer></script>
  </body>
</html>