Template for creating prototypes with Stencil.js and Calcite compnents
-
click "Use this Template" and "Create a new repository"
-
clone repo to your developer machine
-
find and replace the string
REPLACE_PROJECT_NAME
with your project name, e.g.hub-chatbot
-
install dependencies
npm i
-
copy Calcite assets
cp -r node_modules/@esri/calcite-components/dist/calcite/assets/* ./src/assets/
' -
create new components with
npx stencil g
- in the first component, import the Calcite assets
import { setAssetPath } from "@esri/calcite-components/dist/components"; setAssetPath("./assets");
-
modify
src/index.html
for your component name and any props.- the example
index.html
uses script to add component to DOM so you can pass complex objects and other dynamic props
- the example
-
run the server
npm run start
When you are ready to create a Github Page (Github action already present) you need to enable the Page and action permissions. After this all pushes to main will rebuild the page.
- push to github
git push origin main
- in Github Repo UI, under **Settings > Actions > General_ in Workflow Permissions change to Read and Write Permissions
- in Github Repo UI, under Settings > Pages in Build and Deployment > Branch choose gh-pages and Save
- Re-run the job.
The first push will fail because the gh-pages branch does not exist until after you push.