GithubHelp home page GithubHelp logo

basileraiwet / rollup-plugin-svelte-static-html Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vladshcherbin/rollup-plugin-svelte-static-html

0.0 1.0 0.0 544 KB

Generate static html file from your Svelte component using Rollup

JavaScript 100.00%

rollup-plugin-svelte-static-html's Introduction

rollup-plugin-svelte-static-html

Build Status Codecov

Generate static html file from your Svelte component using Rollup.

Installation

# yarn
yarn add rollup-plugin-svelte-static-html -D

# npm
npm install rollup-plugin-svelte-static-html -D

Usage

// rollup.config.js
import svelteStaticHtml from 'rollup-plugin-svelte-static-html'

export default {
  input: 'src/index.js',
  output: {
    file: 'dist/app.js',
    format: 'iife'
  },
  plugins: [
    svelteStaticHtml({
      component: 'src/App.svelte',
      output: 'dist/index.html',
      template: 'src/assets/template.html'
    })
  ]
}

Configuration

There are some useful options:

component

Type: string

Path to the component from which html is generated.

svelteStaticHtml({
  component: 'src/App.svelte'
})

output

Type: string

Path for the generated html file.

svelteStaticHtml({
  component: 'src/App.svelte',
  output: 'dist/index.html'
})

template

Type: string

Path to the template to use. When not set, only component html is saved.

svelteStaticHtml({
  component: 'src/App.svelte',
  output: 'dist/index.html',
  template: 'src/assets/template.html'
})

selector

Type: string | Default: body

Selector to append generated component html to. Can be a tag, a class or an id. Only used only when template is set.

svelteStaticHtml({
  component: 'src/App.svelte',
  output: 'dist/index.html',
  template: 'src/assets/template.html',
  selector: '#widget'
})

props

Type: object

Properties to pass to the component.

svelteStaticHtml({
  component: 'src/App.svelte',
  output: 'dist/index.html',
  props: {
    name: 'Jack'
  }
})

inlineCss

Type: boolean | Default: false

Add component css to the top of generated html or append to head if template is set.

svelteStaticHtml({
  component: 'src/App.svelte',
  output: 'dist/index.html',
  inlineCss: true
})

preprocess

Type: array | object

Preprocess the component. By default, svelte-preprocess is used in auto mode.

svelteStaticHtml({
  component: 'src/App.svelte',
  output: 'dist/index.html',
  preprocess: [
    scss(),
    pug()
  ]
})

License

MIT

rollup-plugin-svelte-static-html's People

Watchers

 avatar

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.