Create your HTML5 Web Component with Svelte. Made your web components with this user friendly boilerplate.
This is a github template, you can fork it or use as template for start new project with this repository as hello-world. I hate start new project with empty template, often i missing correct configuration, readme instruction or i need of samples of code. Use this repository as template solve this problem.
This project is free, open source and I try to provide excellent free support. Why donate? I work on this project several hours in my spare time and try to keep it up to date and working. THANK YOU!
See Demo here.
<svelte-webcomponent-boilerplate
header="make"
flip="svelte,webcomponents,opensource"
footer="awesome!"
></svelte-webcomponent-boilerplate>
</body>
):<script src="https://cdn.jsdelivr.net/npm/@ptkdev/svelte-webcomponent-boilerplate@latest/dist/webcomponent.js"></script>
You can replace @latest
with specific version, example @2.0.1
.
Below is available a description of options
values.
npm install @ptkdev/svelte-webcomponent-boilerplate --save
<svelte-webcomponent-boilerplate
header="make"
flip="svelte,webcomponents,opensource"
footer="awesome!"
></svelte-webcomponent-boilerplate>
require("@ptkdev/svelte-webcomponent-boilerplate");
or
import "@ptkdev/svelte-webcomponent-boilerplate";
Below is available a description of options
values.
Appearance
--> Widget
--> insert HTML Widget
and paste html code:<svelte-webcomponent-boilerplate
header="make"
flip="svelte,webcomponents,opensource"
footer="awesome!"
></svelte-webcomponent-boilerplate>
You can insert this html code in posts, widget, html box or theme.
npm install @ptkdev/svelte-webcomponent-boilerplate@latest --save
:src/App.js
on header:import "@ptkdev/svelte-webcomponent-boilerplate";
App.js
template:<svelte-webcomponent-boilerplate
header="make"
flip="svelte,webcomponents,opensource"
footer="awesome!"
></svelte-webcomponent-boilerplate>
npm install @ptkdev/svelte-webcomponent-boilerplate@latest --save
:app/app.modules.ts
on header:import "@ptkdev/svelte-webcomponent-boilerplate";
<svelte-webcomponent-boilerplate
header="make"
flip="svelte,webcomponents,opensource"
footer="awesome!"
></svelte-webcomponent-boilerplate>
npm install @ptkdev/svelte-webcomponent-boilerplate@latest --save
:src/App.svelte
on header:import "@ptkdev/svelte-webcomponent-boilerplate";
<svelte-webcomponent-boilerplate
header="make"
flip="svelte,webcomponents,opensource"
footer="awesome!"
></svelte-webcomponent-boilerplate>
npm install @ptkdev/svelte-webcomponent-boilerplate@latest --save
:src/App.vue
and add webcomponent to ignoreElements of vue config:import Vue from "vue";
import "@ptkdev/svelte-webcomponent-boilerplate";
Vue.config.ignoredElements = ["svelte-webcomponent-boilerplate"];
<svelte-webcomponent-boilerplate
header="make"
flip="svelte,webcomponents,opensource"
footer="awesome!"
></svelte-webcomponent-boilerplate>
Parameter | Description | Values | Default value | Available since |
---|---|---|---|---|
header | Setup top text | String | make |
v1.0.20210319 |
flip | Setup middle flip text (separte with commas) | String with commas | svelte,webcomponents,opensource |
v1.0.20210319 |
footer | Setup bottom text | String | awesome! |
v1.0.20210319 |
<svelte-webcomponent-boilerplate
header="make"
flip="svelte,webcomponents,opensource"
footer="awesome!"
></svelte-webcomponent-boilerplate>
You can overwrite default css with selector ::part
, example:
<style>
svelte-webcomponent-boilerplate::part(flip) {
border: 2px solid red;
}
</style>
Part attribute is, generally, suffix of a class. Use chrome inspector for get the correct value of part=""
attributes. See MDN selector ::part docs.
npm install
npm run dev
http://localhost:5000
If you want replace all strings (example: package name, author, urls, etc...) in markdown file, source files and others files of this project you need edit setup.json
with correct values and run npm run setup
.
Run npm run docs
Thanks to all our backers! 🙏 Donate 3$ or more on paypal, ko-fi, github or patreon and send me email with your avatar and url.
I ❤️ contributions! I will happily accept your pull request! (IMPORTANT: Only to nightly branch!) Translations, grammatical corrections (GrammarNazi you are welcome! Yes my English is bad, sorry), etc... Do not be afraid, if the code is not perfect we will work together 👯 and remember to insert your name in .all-contributorsrc
and package.json
file.
Thanks goes to these wonderful people (emoji key):
Patryk Rzucidło 💻 🌍 📖 🐛 |
💰 In the future, if the donations allow it, I would like to share some of the success with those who helped me the most. For me open source is share of code, share development knowledges and share donations!