8000 GitHub - vuejs/rollup-plugin-vue at d366c20be56e90f1b576afa78bd082af210417af
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Jan 18, 2022. It is now read-only.

vuejs/rollup-plugin-vue

Repository files navigation

Rollup Plugin for Vue

As vue-loader is for webpack and vueify is for browserify, similarly its for rollup. As we know, webpack and browserify concat stuff and make it runnable in browser. Its difficult to share .vue components. Now roll your Vue components.

With rollup you can break your application into reusable modules.

See docs for installing, using and contributing.

Rollup Plugin for Vue

Build Status Coverage Status Software License NPM Latest Version Issues

Quick Start

Create project with vue-cli!

vue init znck/vue-plugin-simple my-project

Rollup! Rollup! Rollup!

Create new project

Install dependencies & build

Usage

import {rollup} from 'rollup';
import vue from 'rollup-plugin-vue';

rollup({
	entry: 'index.js',
	plugins: [vue()]
});

Below is how you can use it from the command line with Bublé. Run rollup -c and it will find the config.

// rollup.config.js
import vue from 'rollup-plugin-vue'
import buble from 'rollup-plugin-buble' // rollup-plugin-babel also works

export default {
  entry: 'index.js',
  plugins: [
    vue(),
    buble()
  ]
}

Examples

Options

css

vue({
  // Filename to write all styles to
  css: 'bundle.scss',

  // Callback that will be called ongenerate with two arguments:
  // - styles: the contents of all style tags combined
  // - styleNodes: an array of style objects: [{lang: 'css', content: 'body { color: green }'}]
  css: function (styles, styleNodes) {
    writeFileSync(cssPath, styles)
  }

  // Disable any style output or callbacks
  css: false,

  // Default behaviour is to write all styles to the bundle destination where .js is replaced by .css
  css: null
})

compileTemplate

vue({
  // Compile templates to render functions (Vue 2 only)
  compileTemplate: true,
})

htmlMinifier

Use any option from https://github.com/kangax/html-minifier

vue({
  htmlMinifier: {}
})

Change log

Please see CHANGELOG for more information what has changed recently.

Testing

$ npm run test

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Security

If you discover any security related issues, please email hi@znck.me instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Sponsor this project

  •  
  •  

Packages

No packages published

Contributors 11

0