@justeattakeaway/pie-webc
v0.5.49
Published
Component bundle containing all PIE web components
Downloads
3,425
Maintainers
Keywords
Readme
Table of Contents
pie-webc
pie-webc
is a wrapper package which contains all PIE web components.
This means that after installing this package as a dependency, you can use as many PIE web components as you like, without bloating your application with unused code, or slowing it down with unnecessary component registrations in the browser.
Installation
To install pie-webc
in your application, run the following on your command line:
npm i @justeattakeaway/pie-webc
yarn add @justeattakeaway/pie-webc
Importing components
Simply import each component individually using its specific entrypoint.
import '@justeattakeaway/pie-webc/components/button.js';
import '@justeattakeaway/pie-webc/components/modal.js';
Or for React applications:
import { PieButton } from '@justeattakeaway/pie-webc/react/button.js';
import { PieModal } from '@justeattakeaway/pie-webc/react/modal.js';
For full information on using PIE components as part of an application, check out the Getting Started Guide.
For maintainers
There is a command that can be run (from the root of the monorepo) which adds all PIE components to this package:
npx add-components
This does the following:
- Loops through the (root)
packages/components
folder to find all of the PIE components, ignoring non-component folders, helper packages, and this package itself. - Adds a
.js
and.d.ts
file for each component to both thecomponents
andreact
directories (insidepie-webc
). - Adds entries for each component to the
exports
field inpie-webc/package.json
. - Adds entries for each component to the
dependencies
field inpie-webc/package.json
, using the current (latest) version.
Generally, there should be no need to run this script. The only time it should be run is when a new component is created using the component generator. The generator runs this script automatically after creating a new component.
changeset
should also make sure that the versions of components are up-to-date.
Contributing
Check out our contributing guide for more information on local development.