nuxt-stencil
v0.1.1
Published
Easy Stencil component library integration with Nuxt.js
Downloads
271
Maintainers
Readme
⚗️ Nuxt.js <> Stencil.js Module
Easy Stencil.js component library integration with Nuxt.js.
:warning: Known issue: Mismatching nodes during client-side hydration
Setup
Install with yarn:
yarn add nuxt-stencil
Install with npm:
npm install nuxt-stencil
nuxt.config.js
module.exports = {
modules: ['nuxt-stencil'],
stencil: {
/**
* Required options
*/
// Your library name, or the path to its root folder.
lib: 'bulmil',
// The prefix to whitelist
prefix: 'bm-',
/**
* Options below are optional
*/
// Stencil rendering options
renderOptions: {},
// By default, it takes the lib name. e.g: bulmil/dist/hydrate
hydratePath: null,
// By default, it takes the lib name. e.g: bulmil/dist/loader
loaderPath: null,
// By default, it takes the prefix. e.g: [/bm-\w*/]
ignoredElements: null,
},
};
How it works
This module has multiple functionalities:
- It creates two hooks for SSR & Generate, using
render:route
&generate:page
, it will render the stencil components before sending back the request to the browser. - It injects a plugin for CSR to define the custom elements from your stencil library.
- It configures
Vue.config.ignoredElements
to ignore custom elements from your stencil library.
Development
- Clone this repository
- Install dependencies using
yarn install
ornpm install
- Start development server using
yarn dev
ornpm run dev