IncludeJS Build Tool / nodejs "bash" scripts
@see IncludeJS Project
> npm install includejs -g
> ijs -help
> ijs [action] [arg] [...] -KEY VALUE [...]
> ijs [*.html] -minify -KEY VALUE
> ijs [*.config | *.js]
Config
Configuration object consists from any number of actions you want to run.
global.config = ActionObject;
global.config = [ActionObject, ActionObject, ];
global.config = {
groupName: ActionObject,
otherGroup: ActionObject,
}
ActionObject
{
action: 'NAME',
}
If ActionObject is in a group, and that groupname has the name of existed action,
then you can ommit 'action' property
global.config = {
copy: {
files: {
'filePath': 'destinationPath',
}
}
}
Actions
build
It is actually the purpose this tool was created for - it combines all resources
included with IncludeJS in your app to a single one-page app
{
"action": "build"
"file": "index.dev.html"
"minify": true,
"uglify": {}
"jshint" : {
"options" :
"globals" :
"ignore" :
}
"outputMain": "index.html" — output name of a built html"
"outputSources": "build/" — directory of combined/copied resources"
}
project-import
{
action: "project-import"
}
Copy resources, that are used by current project, from referenced directories in .reference/* to .import directory
project-reference
{
action: "project-reference"
}
Switch back from "project-import" to resource referencing
shell
{
action: "shell",
command: [
"cmd /C copy /B index.html c:/app",
"cmd /C copy /B index.build/ c:/app/index.build",
]
}
Execuate shell commands
Custom Scripts - (bash scripts)
{
action: "custom",
script: "scriptPath.js"
}
Run any javascript
> ijs custom scriptPath
Custom script should export process(config, done){} function
include.exports = {
process: function(config, done){
done();
}
}
@IMPORTANT
Server
{
action: 'server',
port: 5777, // default 5777
open: 'index.dev.html' // auto open file in browser
}
Start integrated server in a current working directory.
To start the server direct from command line, use cli action pattern
ijs [action] -KEY VALUE
> ijs server -port 5500
Reference (Symbolic Links)
{
"action": "reference"
"path": directory path || name of a project from globals.txt
"name": reference name
}
> ijs reference libjs
Creates symbolic link in "%current directory%/.reference" folder
Template - Scaffolding
{
action: "template",
name: "name"
}
> ijs template [name]
Templates:
-
starter - MaskJS/mask.bindings/jmask/mask.compo/IncludeJS/Ruqq/jQuery
-
compo - creates component template .js/.css/*.mask : ```> ijs template compo desiredName"
-
todoapp - creates todomvc sample application
You can create any other templates - just put the files to:
%npm-global-directory%/node_modules/includejs/template/%YourTemplateName%
Clone LibJS Libraries
> ijs git-clone
Global Projects and default routes:
> ijs globals
Sample:
{
"projects":{
"libjs" : {
"path": "file:///c:/Development/libjs/"
}
},
"defaultRoutes":{
"lib": "{libjs}/{0}/lib/{1}.js",
"ruqq": "{libjs}/ruqq/lib/{0}.js",
"compo": "{libjs}/compos/{0}/lib/{1}.js"
}
}