0.11.3 • Published 1 year ago

jalla v0.11.3

Weekly downloads
25
License
MIT
Repository
github
Last release
1 year ago

jalla

stability experimental npm version build status downloads js-standard-style

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')

// deny robots access unless in production
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

  • Add bundle splitting for CSS
  • Document configuration and options
  • Document middleware
  • Document SSR
  • Document meta tags
  • Export compiled files to disc
  • Export compiled HTML to disc
  • Resolve dynamic routes on export
1.0.0-40

1 year ago

1.0.0-39

2 years ago

1.0.0-38

3 years ago

1.0.0-37

3 years ago

1.0.0-36

3 years ago

1.0.0-35

3 years ago

1.0.0-34

4 years ago

1.0.0-33

4 years ago

1.0.0-32

4 years ago

1.0.0-31

4 years ago

1.0.0-30

4 years ago

1.0.0-29

4 years ago

1.0.0-28

4 years ago

1.0.0-27

4 years ago

1.0.0-26

4 years ago

1.0.0-25

4 years ago

1.0.0-24

4 years ago

1.0.0-23

4 years ago

1.0.0-22

4 years ago

1.0.0-21

4 years ago

1.0.0-20

5 years ago

1.0.0-19

5 years ago

1.0.0-18

5 years ago

1.0.0-17

5 years ago

1.0.0-16

5 years ago

1.0.0-15

5 years ago

1.0.0-14

5 years ago

1.0.0-13

5 years ago

1.0.0-12

5 years ago

1.0.0-11

5 years ago

1.0.0-10

5 years ago

1.0.0-9

5 years ago

1.0.0-8

5 years ago

1.0.0-7

5 years ago

1.0.0-6

5 years ago

1.0.0-5

5 years ago

1.0.0-4

5 years ago

1.0.0-3

5 years ago

0.11.3

5 years ago

1.0.0-2

5 years ago

1.0.0-1

5 years ago

1.0.0-0

5 years ago

0.12.0-14

5 years ago

0.12.0-13

5 years ago

0.12.0-12

5 years ago

0.12.0-11

5 years ago

0.11.2

5 years ago

0.12.0-10

5 years ago

0.12.0-9

5 years ago

0.12.0-8

5 years ago

0.11.1

5 years ago

0.12.0-7

5 years ago

0.12.0-6

5 years ago

0.12.0-5

5 years ago

0.12.0-4

5 years ago

0.12.0-3

5 years ago

0.12.0-2

5 years ago

0.12.0-1

5 years ago

0.12.0-0

5 years ago

0.11.0-5

5 years ago

0.11.0-4

5 years ago

0.11.0-3

5 years ago

0.11.0-2

5 years ago

0.11.0-1

5 years ago

0.11.0-0

5 years ago

0.11.0

5 years ago

0.10.0

5 years ago

0.10.0-20

5 years ago

0.9.5

5 years ago

0.10.0-19

5 years ago

0.9.4

5 years ago

0.10.0-18

5 years ago

0.10.0-17

5 years ago

0.10.0-16

5 years ago

0.10.0-15

6 years ago

0.10.0-14

6 years ago

0.10.0-13

6 years ago

0.10.0-12

6 years ago

0.10.0-11

6 years ago

0.10.0-10

6 years ago

0.10.0-9

6 years ago

0.9.3

6 years ago

0.10.0-8

6 years ago

0.10.0-7

6 years ago

0.10.0-6

6 years ago

0.10.0-5

6 years ago

0.9.2

6 years ago

0.10.0-4

6 years ago

0.10.0-3

6 years ago

0.9.1

6 years ago

0.10.0-2

6 years ago

0.10.0-1

6 years ago

0.10.0-0

6 years ago

0.9.0

6 years ago

0.8.0

6 years ago

0.7.4

6 years ago

0.7.3

6 years ago

0.7.2

6 years ago

0.7.1

6 years ago

0.7.0

6 years ago

0.6.1

6 years ago

0.6.0

6 years ago

0.5.2

6 years ago

0.5.1

6 years ago

0.5.0

6 years ago

0.4.1

6 years ago

0.4.0

6 years ago

0.3.5

6 years ago

0.3.4

6 years ago

0.3.3

6 years ago

0.3.2

6 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago