Smartcomb: web module splitters implemented using php, smartcombweb. Smartcomb: a php-implemented web module combiner. smartcombwebsmartcomb is a php-implemented web module combiner. compared with other code combiner tools, the following features can be combined: web module splitters implemented using php, smartcombweb
Smartcomb is a web module concatenation tool implemented in php. compared with other code Splicing tools, smartcomb has the following features:
- Any types of files can be combined, not limited to js files.
- Centralize and declare dependencies, automatically analyze dependencies, and load them as needed.
- Supports multiple configuration switches
- Automatically modify the image path in css and less. you do not need to worry about css Image path errors after splicing.
- Supports php command line calls and directly generates static files.
Github address: https://github.com/hafeyang/smartcomb
Module declaration configuration
Smartcomb is composedsmartcomb.phpAndmodules.jsComposition,modules.jsIt is a json file and must be in strict json format. the key must be enclosed in double quotation marks for module declaration. Format:
{[Profile]: {"basePath": "Basic paths common to all files", "modules": {"[modulename]": {[type1]: ["file1 ", "file2"], "dependencies": ["depend module name", "", ""] }}}
The following is a demo:
{ "default":{ "basePath":"modules/", "modules":{ "base":{ "js":["base/base.js?1.1.15","base/common.js?1.1.15"], "css":["base/reset.css?1.1.15"], "less":["base/reset.less"] }, "pageA":{ "js":["pageA/pageA-util.js?1.1.15","pageA/pageA.js?1.1.15"], "css":["pageA/pageA.css?1.1.15"], "dependencies":["base"] } } }}
Use in web
The demo above declares the module configuration with the profile as default. Declare two modules base and pageA. pageA depends on the base module. The base module contains two js files: modules/base. js. The path is relativesmartcomb.phpPath, the file type can be defined at any time, and the type can be specified during use.
As shown in the preceding configuration file, we can reference the following on the page: