Compilation
Nools
can also be used in the browser. The only difference is that you cannot pass a file location to the compile method instead you must provide the source.
Nools is compatible with amd(requirejs) and can also be used in a standard script tag.
Browser Example
In this example we compile rules definitions inlined in a script tag.
Using a compiled dsl.
You may also use the nools
executable to compile source into a browser friendly format skipping the need for compiling each time.
To use the flow require the compile version either through a script tag, amd/requirejs
, or commonjs
require.
If you import the flow using a script tag you can get a reference to the flow by using nools.getFlow
.
You may also specify the name of the flow when compiling, it defaults to the name of the nools file less ".nools"
If you are using requirejs or nools must be required using something other than require("nools")
then you can specify a location of the nools source.
RequireJS examples
Examples of using nools with require js are located in the examples directory.