GithubHelp home page GithubHelp logo

c0bra / svelma Goto Github PK

View Code? Open in Web Editor NEW
537.0 11.0 44.0 1.99 MB

Bulma components for Svelte

Home Page: https://c0bra.github.io/svelma

License: MIT License

JavaScript 9.32% CSS 1.30% HTML 88.71% Shell 0.66%
svelte sveltejs svelte-components bulma svelte3

svelma's Introduction

Svelma

Svelma is a set of UI components for Svelte based on the Bulma CSS framework.

Change Log

Documentation

See docs + demos site here

Quick Start

1. Import svelma and dependencies via npm to your project

$ npm install --save bulma svelma
$ npm install node-sass svelte-preprocess rollup-plugin-postcss --save-dev

2. Add the postcss plugin to your rollup config

// rollup.config.js
import postcss from 'rollup-plugin-postcss'
import preprocess from 'svelte-preprocess'

// ...

export default {
  // ...
  plugins: [
    svelte({
      // ...
      preprocess: preprocess()
    }),

    postcss(),
  ]
}

3. Import Bulma's CSS and Svelma components

<!-- App.svelte -->
<script>
  import 'bulma/css/bulma.css'
  import { Button } from 'svelma'
</script>

<Button type="is-primary">I'm a Button!</Button>

4. Include Font Awesome icons

From CDN in your HTML page:

<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" />

Or as an npm package imported into your root component:

$ npm install --save @fortawesome/fontawesome-free

<!-- App.svelte -->
<script>
  import 'bulma/css/bulma.css'
  import '@fortawesome/fontawesome-free/css/all.css'
</script>

SSR

If you are doing server-side rendering with Sapper (or SvelteKit), you'll need to import the .svelte files directly so that your app can compile them, rather than importing from the compiled module.

i.e.:

import Button from 'svelma/src/components/Button.svelte'

instead of

import { Button } from 'svelma'

Inspiration

Much thanks to the Buefy and Svelma2 projects! It provided the inspiration and lots of code examples for this version of Svelma.

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.