jalla

Jalla is an opinionated web compiler and server in one, intended for both
development and production use. Jalla puts together popular tools and frameworks
that make web development fun and performant.
Jalla is intended to be used when static files doesn't cut it and you need to
dynamically render your views, HTTP/2 push dynamic assets or integrate with
other back end services. The stack consists of a Koa server, a
Browserify bundler for scripts and PostCSS for styles.
Documents are compiled using Documentify. Jalla is built with
Choo in mind and is heavily inspired by Bankai. In fact,
if static bundling and CSS-in-JS is your thing, you'll probably have a better
time using Bankai.
Usage
$ jalla index.js
API
Middleware can be added by creating an instance of the server. The application
is an instance of Koa and supports all Koa middleware.
var mount = require('koa-mount')
var jalla = require('jalla')
var app = jalla('index.js')
app.use(mount('/robots.txt', function (ctx, next) {
if (process.env.NODE_ENV === 'production') return next()
ctx.type = 'text/plain'
ctx.body = `
User-agent: *
Disallow: /
`
}))
app.listen(8080)
ctx.assets
Compiled assets (js, css) are exposed on the koa ctx
object as a dictionary
with their file
, map
, buffer
and url
as property keys.
Events
Most of the internal workings are exposed as events on the application (Koa)
instance.
app.on('error', callback(err))
When an internal error occurs or a route could not be served. If an HTTP error
was encountered, the status code is available on the error object.
app.on('warning', callback(warning))
When a non-critical error was encountered, e.g. a postcss plugin failed to parse
a rule.
app.on('progress', callback(file, uri))
When a change is detected to an entry file and processing begins.
app.on('bundle:script', callback(file, uri, buff)
When a script file finishes bundling.
app.on('bundle:style', callback(file, uri, buff)
When a css file finishes bundling.
app.on('bundle:file', callback(file))
When a file is being included in a bundle.
app.on('timing', callback(time, ctx))
When a HTTP response has been sent.
app.on('start', callback(port))
When the server starts.
Todo