Giter Site home page Giter Site logo

lguzzon-js / svelte-component-library-template Goto Github PK

View Code? Open in Web Editor NEW

This project forked from patoi/svelte-component-library-template

0.0 1.0 0.0 1.44 MB

A base for building Svelte component library.

License: MIT License

JavaScript 68.13% CSS 8.19% HTML 9.14% Svelte 14.54%

svelte-component-library-template's Introduction

Build Status Dependabot

Svelte Components template

You can create your own component library to your applications with this template.

A base for building Svelte component library.

Original work is https://github.com/sveltejs/component-template

Using

On GitHub:

Use this template button on top right.

Read more: Creating a repository from a template

CLI:

  1. Clone it with degit
npx degit patoi/svelte-component-library-template svelte-component-library-template
cd svelte-component-library-template
npm install # or yarn
  1. Add your component's code to src/ as directory, e.g.: src/HelloComponent/ (or add your component directly to src/).

  2. Export the new component to apps in src/index.js

  3. src/test.js and src/App.svelte are for testing purposes:

  1. Create your test cases to your component:
  • add tests to test/ directory

Development

  1. npm install

  2. npm run dev :

  • build components on change and
  • serves from public/ directory at http://localhost:5000
  • and handling livereload
  1. npm test : test runner

For changing the view of the test page use public/global.css and public/index.html

Using components in app

https://github.com/rollup/rollup-plugin-svelte#pkgsvelte

Tip: if you are a developer of the component library, then you can install it once as devDependencies to app with npm i -D <path-to-your-components> , all change will appear immediately if you use livereload in app.

Import component library into your app in App.svelte :

<script>
  import { ByeBye, Hello } from 'svelte-component-library-template'
  export let name
</script>

<Hello {name} />
<ByeBye {name} />

Technical background

More: https://github.com/sveltejs/sapper-template/blob/master/README.md#using-external-components

Supported Node.js v12 LTS and v14 LTS.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.