Lithe
A browser-side script loader,compatible with the de facto standards(NodeJS/CommonJS). It's very simple and small,only 2.7kb gzipped.
If you use Gruntjs to build your project , you can use grunt-lithe
You can use bower manage modules Easier.
Chinese Documentation 中文文档
Installation
$ npm install lithe -g$ git clone https://github.com/litheModule/lithe$ cd lithe$ npm install -d
command tools
$ lithe Usage: lithe [options] [command] Commands: build <source> <target> build source to target compress <source> <target> compress source to target getpackage <source> <target> get source requires to target package Options: -h, --help output usage information -V, --version output the version number -c, --config <path> set the config file,it will be return alias and basepath
public api for browser
define
//path/to/file.js;
require
//path/to/app.js;
lithe.use
//anywherelithe;//orlithe;
config
; ;
public api for node
//npm install lithevar lithe = tool = lithetoolhfs = lithehfsoptions = tooloptions; optionsbasepath = 'your project base dir';optionsuglifyPath = 'your uglifyjs dir';optionsalias = {}; //your short alias config
tool.findJsAllrequires([filepath])
var requires = tool;//app.js's requires are findout and alias will be replaced
tool.concatFile([files],[target])
tool;//file1 and file2 will be merger
tool.uglifyJs([filepath],[target])
tool;//Equivalent uglifyjs --reserved-names require -o path/to/file1&file2-min.js /path/to/file1&file2.js
hfs.cpdirSync([sourceDir],[targetDir])
hfs;//copy the folder by sync,if targetDir not exist it will be created.//.git and .svn will be continue.
hfs.delSync([path])
hfs;hfs;//del the folder or file sync//.git and .svn will be continue.
hfs.mkdirSync([target])
hfs//if the '/path' folder not exist,it will be created.
hfs.walk([path],[callback],[options])
hfs;//it's worked sync
hfs.writeFileSync([filepath],[data],[encoding = utf8])
hfs;//if path folder not exist,it will be created.
How to deploy in the web browser?
License
BSD license