Smartcomb is composed of smartcomb.php and modules.js. modules.js is a json file, which must be in strict json format. The key needs to be enclosed in double quotes for module declaration. The format is:
{
[profile]:{
"basePath": "The base path common to all files",
"modules":{
"[modulename]":{
[type1]:["file1","file2"],
"dependencies":["depend module name","",""]
}
}
}
}
Here is a demo:
{
"default":{
"basePath":"modules/",
"modules":{
"base":{
"js":["base/base.js","base/common.js"],
"css":["base/reset.css"],
"less":["base/reset.less"]
},
"pageA":{
"js":["pageA/pageA-util.js","pageA/pageA.js"],
"css":["pageA/pageA.css"],
"dependencies":["base"]
}
}
}
}
Used in web
The above demo declares the module configuration with profile as default. Declare two modules base and pageA, pageA depends on the base module. The base module includes two js files: modules/base/base.js. This path is relative to smartcomb.php. The file type can be defined arbitrarily. Just specify the type when using it.
For the above configuration file, we can quote it in the page as follows:
pageA depends on the base module. smartcomb automatically combines dependent files.
smartcomb.php calling parameters:
profile: configuration type, default is default. Use this parameter to switch profile
type: file type, the type in the module declaration, can be any customized file type, the default is js
modules: modules that need to be combined, multiple modules can be used, split
The parameters are consistent with the web calling method
Thanks, any questions, please contact me:)
http://www.bkjia.com/PHPjc/477823.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/477823.htmlTechArticlesmartcomb is a web module splicer implemented in PHP. Compared with other code splicing tools, it has the following features: Yes Splice any type of files, not limited to js files. Focus and declare...
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn