rollup-plugin-vue2

0.0.2 • Public • Published

Rollup plugin for Vue 2.0

Transform .vue components & precompile templates

Ready to transpile ES6 with rollup-plugin-buble & rollup-plugin-babel
Fastest bundle by precompiling templates with vue-template-compiler
Let's see the example config

No support for vue-hot-reload-api (help needed)
No support for css compilation, but can trigger another build tool

Software License Issues JavaScript Style Guide NPM Latest Version

Installation

npm install --save-dev rollup-plugin-vue2

Usage

Put vue() before any transpiler like Bublé or Babel

// rollup.config.js
import vue from 'rollup-plugin-vue2';
import buble from 'rollup-plugin-buble';
import nodeResolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import uglify from 'rollup-plugin-uglify';

export default {
  entry: 'src/main.js',
  dest: 'dist/bundle.js',
  plugins: [
    vue(),
    buble(),
    nodeResolve({ browser: true, jsnext: true, main: true }),
    commonjs(),
    uglify()
  ]
}

Time to rollup!

# Build
#  -c will default to rollup.config.js
rollup -c

# Development
#  -w will watch for changes
rollup -c -w

Options

There is only 1 option for now: css. By default the plugin will base the filename for the css on the bundle destination.

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: 'body { color: green }'
  // - styleNodes: an array of style objects: [{lang: 'css', content: 'body { color: green }'}]
  css: function (styles, styleNodes) {
    writeFileSync('bundle.scss', 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
})

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

The linter will check for JS Standard Style

# Unittests
npm run unit

# Linting
npm run lint

# Run all the above
npm run test

Contributing

Contributions and feedback are very welcome.

To get it running:

  1. Clone the project.
  2. npm install
  3. npm run build

Credits

License

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

Package Sidebar

Install

npm i rollup-plugin-vue2@0.0.2

Version

0.0.2

License

MIT

Last publish

Collaborators

  • thgh