Skip to content

luckydrq/jade-flow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jade-flow

A powerful control flow model described by jade syntax.Inspired by koa.

You can write middleware/task in the same way as koa middleware.

Control flow in Koa

As we all know in koa, the control flow goes like this:

Let's say it looks like a U shape:

Once the flow reaches the bottom of the middleware stack, it has to go back along the way it comes.

What's the difference in jade-flow

It provides much more flexibilities and allows the control flow go like a W shape as below:

pic a:

or pic b:

Actually, you can make it whatever you want. All you need is a XML file to descirbe it.

For pic a as shown above, we can describe the flow like this:

middleware1
  middleware2
    middleware3
  middleware3

For pic b as shown above, we can describe the flow like this:

middleware1
  middleware2
middleware2
  middleware3

If you want it to behave as koa style, just describe it like this:

middleware1
middleware2
middleware3

Why jade?

Because it is convienient to write XML using its syntax. By using its lexer and parser, we can get the AST and analize what the flow is composed of.

Install

$ npm install jade-flow

Example

In real world, we can use this control flow model to handle multiple tasks that combined together to accomplish one goal, e.g. front end assets build includes tasks such as concat, sass(less), minify, uglify and so on.

Lisence

MIT

About

a powerful control flow described by jade

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published