Created
February 27, 2017 19:22
-
-
Save porsager/184f8fa4e3c2aff573ceef07b000fc39 to your computer and use it in GitHub Desktop.
Wright and rollup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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