Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mariuslundgard/protopack
WORK-IN-PROGRESS. A bundler for prototypes.
https://github.com/mariuslundgard/protopack
Last synced: 2 days ago
JSON representation
WORK-IN-PROGRESS. A bundler for prototypes.
- Host: GitHub
- URL: https://github.com/mariuslundgard/protopack
- Owner: mariuslundgard
- Created: 2018-07-23T18:54:55.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-08-09T22:12:46.000Z (about 6 years ago)
- Last Synced: 2024-10-03T10:37:48.654Z (about 1 month ago)
- Language: JavaScript
- Homepage:
- Size: 722 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# protopack
**WORK-IN-PROGRESS**. A bundler for prototypes.
```sh
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`):
```js
// .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:
```sh
NODE_ENV=production npx protopack build
```### Node.js API
```js
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
```js
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`](https://github.com/popeindustries/inline-source#readme)?)
- [ ] Hot-reloading
- [ ] Support custom `babel` presets/plugins
- [ ] Support custom `postcss` plugins
- [ ] Directory listing
- [x] `express` middleware
- [x] Install missing npm modules on `build()`