protopack
A bundler for prototypes.
Last updated a year ago by mariuslundgard .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install protopack 
SYNC missed versions from official npm registry.

protopack

WORK-IN-PROGRESS. A bundler for prototypes.

npm install protopack --save-dev

Documentation

protopack is built on top of rollup, babel, postcss and many other libraries.

Get started

Create a new directory for a prototype. Add a file called .protopack.config.js (or protopack.json):

// .protopack.config.js
'use strict'

module.exports = {
  input: './src/index.html',
  output: './dist/index.html'
}

Create a new directory called src, and add an index.html file to it.

Then call:

NODE_ENV=production npx protopack build

Node.js API

import path from 'path'
import {build} from 'protopack'

const opts = {
  cwd: path.resolve(__dirname, '..'),
  baseUrl: 'http://localhost:3000'
}

build(opts)
  .then(results => {
    console.log('Built ok')
  })
  .catch(err => {
    console.error(err)
  })

Express middleware

import express from 'express'
import path from 'path'
import {middleware} from 'protopack'

const app = express()

const opts = {
  cwd: path.resolve(__dirname, '..'),
  baseUrl: 'http://localhost:3000'
}

// Use the middleware before routes
app.use(middleware(opts))

app.listen(3000, () => {
  console.log('Listening at http://localhost:3000')
})

TODO

  • [ ] Support images
  • [x] Support inline styles/scripts (via inline-source?)
  • [ ] Hot-reloading
  • [ ] Support custom babel presets/plugins
  • [ ] Support custom postcss plugins
  • [ ] Directory listing
  • [x] express middleware
  • [x] Install missing npm modules on build()

Current Tags

  • 0.0.1-alpha.8                                ...           latest (a year ago)

8 Versions

  • 0.0.1-alpha.8                                ...           a year ago
  • 0.0.1-alpha.7                                ...           a year ago
  • 0.0.1-alpha.6                                ...           a year ago
  • 0.0.1-alpha.5                                ...           a year ago
  • 0.0.1-alpha.4                                ...           a year ago
  • 0.0.1-alpha.3                                ...           a year ago
  • 0.0.1-alpha.2                                ...           a year ago
  • 0.0.1-alpha.1                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 1
Last Day 1
Last Week 0
Last Month 9
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |