koajs / bundle Goto Github PK
View Code? Open in Web Editor NEWGeneric asset pipeline with caching, etags, minification, gzipping and sourcemaps.
Generic asset pipeline with caching, etags, minification, gzipping and sourcemaps.
Hi!
I'm on [email protected]
, koa-bundle@^1.0.13
and koa@^1.0.0
. The first example, the browserify one, in the documentation fails to run. Here is my code:
var koa = require('koa');
var Bundle = require('koa-bundle');
var browserify = require('browserify');
var app = koa()
var bundle = Bundle({debug:true},function(file, fn) {
browserify({debug:true}).add(file.path).transform(require('babelify')).bundle(fn)
});
app.use(bundle('js/index.js'))
app.listen(3000);
Here's what happens when I try to run it:
Venjetindan:mobill jonpacker$ node index.js
path.js:8
throw new TypeError('Path must be a string. Received ' +
^
TypeError: Path must be a string. Received undefined
at assertPath (path.js:8:11)
at posix.join (path.js:477:5)
at fullpath (/Users/jonpacker/Development/Projects/mobill/node_modules/koa-bundle/index.js:426:30)
at entry (/Users/jonpacker/Development/Projects/mobill/node_modules/koa-bundle/index.js:116:12)
at _bundle (/Users/jonpacker/Development/Projects/mobill/node_modules/koa-bundle/index.js:87:19)
at Object.<anonymous> (/Users/jonpacker/Development/Projects/mobill/index.js:10:9)
at Module._compile (module.js:434:26)
at Object.Module._extensions..js (module.js:452:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
cleaned up version of:
var toHTML = require('ansii-html')
this.body = 'document.body.innerHTML = "<pre style=\\"padding:50px;\\">' + toHTML(msg).replace(/['"]/gm, '\\\"').replace(/(\r\n|\n|\r)/gm, '<br/>') + '</pre>";';
csso can't handle some css
Missing the map, and path isn't relative to the root instance.
so we're not waiting a while on the first request.
How can we cache responses from bundled assets? What would be your recommended approach? Using gulp?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.