A powerful control flow model described by jade syntax.Inspired by koa.
You can write middleware/task in the same way as koa middleware
.
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.
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
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.
$ npm install jade-flow
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.
MIT