All Projects → YogliB → Svelte Component Template

YogliB / Svelte Component Template

Licence: other
A base for building shareable Svelte 3 components

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Svelte Component Template

Redocx
📄 Create word documents with React
Stars: ✭ 1,331 (+539.9%)
Mutual labels:  library, components
Chat Ui Kit React
Build your own chat UI with React components in few minutes. Chat UI Kit from chatscope is an open source UI toolkit for developing web chat applications.
Stars: ✭ 131 (-37.02%)
Mutual labels:  library, components
Atlas.js
A component-based Node.js library to reduce boilerplate and provide sane project structure 🍻
Stars: ✭ 108 (-48.08%)
Mutual labels:  library, components
Kit
Tools for developing, documenting, and testing React component libraries
Stars: ✭ 1,201 (+477.4%)
Mutual labels:  library, components
React Messenger
Chat UX components built with React, inspired by Facebook Messenger
Stars: ✭ 167 (-19.71%)
Mutual labels:  library, components
Neumorphic Ui
📚 A library of components based on the concept of neumorphism
Stars: ✭ 82 (-60.58%)
Mutual labels:  library, components
Thorui Uniapp
ThorUI组件库,轻量、简洁的移动端组件库。组件文档地址:https://thorui.cn/doc/ 。 最近更新时间:2021-10-01
Stars: ✭ 1,842 (+785.58%)
Mutual labels:  components, template
Contactlab Ui Components
DEPRECATED - Basic UI components for ContactLab UX design pattern library
Stars: ✭ 31 (-85.1%)
Mutual labels:  library, components
Library Template Android
A Kotlin + Android library template (with a sample project).
Stars: ✭ 151 (-27.4%)
Mutual labels:  library, template
Blazorise
Blazorise is a component library built on top of Blazor with support for CSS frameworks like Bootstrap, Bulma, AntDesign, and Material.
Stars: ✭ 2,103 (+911.06%)
Mutual labels:  library, components
Egeo
EGEO is the open-source UI library used to build Stratio's UI. It includes UI Components, Utilities, Services and much more to build user interfaces quickly and with ease. The library is distributed in AoT mode.
Stars: ✭ 69 (-66.83%)
Mutual labels:  library, components
Terraform Aws Components
Opinionated, self-contained Terraform root modules that each solve one, specific problem
Stars: ✭ 168 (-19.23%)
Mutual labels:  library, components
Tail Kit
Tail-kit is a free and open source components and templates kit fully coded with Tailwind css 2.0.
Stars: ✭ 997 (+379.33%)
Mutual labels:  components, template
Svelte Pwa
Svelte Progresssive Web App (PWA) starter template
Stars: ✭ 87 (-58.17%)
Mutual labels:  template, svelte
Webrix
Powerful building blocks for React-based web applications
Stars: ✭ 41 (-80.29%)
Mutual labels:  library, components
React Rainbow
🌈 React Rainbow Components. Build your web application in a snap.
Stars: ✭ 1,662 (+699.04%)
Mutual labels:  library, components
Awesome Ui Component Library
Curated list of framework component libraries for UI styles/toolkit
Stars: ✭ 702 (+237.5%)
Mutual labels:  library, components
Genus
A general code generation tools for Go applications
Stars: ✭ 11 (-94.71%)
Mutual labels:  library, template
Tosin
Initialize a npm package with everything included, from CI to documentation website
Stars: ✭ 142 (-31.73%)
Mutual labels:  library, template
Ng Aquila
Angular UI Component library for the Open Insurance Platform
Stars: ✭ 170 (-18.27%)
Mutual labels:  library, components

Svelte 3 Component Template

Known Vulnerabilities PRs Welcome

Table of Contents

  1. Features
  2. Getting started
  3. Developing
  4. Consuming components
  5. Backward Compatibility
  6. Preprocessors
  7. Testing
  8. Publishing to npm
  9. Frequently Asked Questions
  10. Credits & Inspiration

Features

  • Autoprefixing CSS
  • Preprocessing
  • Formating
  • Linting
  • Testing
  • Storybook

Getting Started

  1. Choose your template (regular/monorepo)

  2. Clone it with degit:

npx degit YogliB/svelte-component-template my-new-component
or
npx degit "YogliB/svelte-component-template#monorepo" my-new-component
  1. cd into the folder and install the node_modules:
cd my-new-component
git init
npm install

or:

yarn
  • For monorepo run:
npm run bootstrap

or:

yarn bootstrap
  1. Run npm init, to configure the project.

Your component's source code lives in src/components/[MyComponent].svelte.

Developing

  1. Start Rollup:
npm run dev
  1. Edit a component file in src/components, save it and watch the magic happens.

  2. Make sure your component is exported in src/components/index.js.

  3. Make sure your component is imported and nested in src/App.svelte, so you can preview and test it.

  4. Navigate to localhost:5000 to see your components live.

Consuming Components

Your package.json has a "svelte" field pointing to src/components/index.js, which allows Svelte apps to import the source code directly, if they are using a bundler plugin like rollup-plugin-svelte or svelte-loader (where resolve.mainFields in your webpack config includes "svelte").

Backward Compatibility

This template uses svelte-preprocess in order to integrate PostCSS auto-prefixing capabilities & Babel's transpiling capabilities into the build process.

Browserlist

PostCSS uses browserlist under the hood, in order to "know" what css to prefix.

The browserlist configuration is located inside the package.json.

Preprocessors

This template comes with the svelte-preprocess by default, which simplifies the use of preprocessors in components.

Usage

Getting Started with svelte-preprocess.

  • To configure svelte-preprocess use the sveltePreprocessConfig variable in ./preprocess.js

Testing

This template uses Cypress & testing-library for testing.

It is highly recommended going through their docs if you intend on testing your components.

You can witness a simple example by running npm run cy:open.

Frequently Asked Questions

What's the index.js file for?

It's for Svelte to be able to import multiple components from a single source.

For instance, it lets the user do:

import { MyComponent, MyOtherComponent } from 'my-component-library';

Instead of:

import MyComponent from 'my-component-library/components/MyComponent.svelte';
import MyOtherComponent from 'my-component-library/components/MyOtherComponent';

How do I include 3'rd party css in my components?

There are a few options to do this:

  1. Don't include 3'rd party css and just tell your users to do that (Probably using PostCSS).
  2. Include it via a cdn, like so:
@import url('https://unpkg.com/@scope/package/main.min.css');

Publishing to npm

Credits & Inspiration

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].