Skip to content

Instantly share code, notes, and snippets.

@porsager
Created February 27, 2017 19:22
Show Gist options
  • Select an option

  • Save porsager/184f8fa4e3c2aff573ceef07b000fc39 to your computer and use it in GitHub Desktop.

Select an option

Save porsager/184f8fa4e3c2aff573ceef07b000fc39 to your computer and use it in GitHub Desktop.
Wright and rollup
const fs = require('fs')
, rollup = require('rollup')
, json = require('rollup-plugin-json')
, commonjs = require('rollup-plugin-commonjs')
, nodeResolve = require('rollup-plugin-node-resolve')
, wright = require('wright')
wright({
main: 'static/index.html',
run: 'm.redraw',
debug: true,
js: {
watch: 'src/js/**/*.js',
path: 'js/app.js',
compile: roll
}
})
let cache
function roll() {
return rollup.rollup({
entry: 'src/app.js',
cache: cache,
plugins: [
json(),
commonjs(),
nodeResolve()
]
})
.then(bundle => {
cache = bundle
bundle.generate({ format: 'iife' }).code
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment