Smartcomb: web module splitters implemented using php

Source: Internet
Author: User

Smartcomb is a web module concatenation tool implemented in php. Compared with other code concatenation tools, smartcomb has the following features: it can splice any type of files, not limited to js files. Centralize and declare dependencies, automatically analyze dependencies, and load them as needed. Supports multiple configuration switches to automatically modify css. The image path in less mode does not need to worry about css image path errors after splicing. Supports php Command Line calls. Supports command-Based Direct Generation of static files. github address: https://github.com/hafeyang/smartcomb the configuration smartcomb.php and modules. JSS, modules. js is a json file and must be in strict json format. Double quotation marks must be added to the key 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 "," 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"] }}} use the demo above to declare the module configuration with profile as default. Declare two modules base and pageA. pageA depends on the base module. The base module consists of two js files: modules/base. js. The path is relative to the path of smartcomb. php. The file type can be defined at will and the type can be specified during use. The preceding configuration file can be referenced as follows on the page: <script type = "text/javascript" src = "path/to/smartcomb. php? Type = js & modules = pageA "> </script> <link href =" path/to/smartcomb. php? Type = css & modules = pageA "type =" text/css "charset =" UTF-8 "/> pageA depends on the base module. Smartcomb automatically binds dependent files. Smartcomb. php call parameter: profile: configuration type. The default value is default. With this parameter, you can switch profiletype: file type, type in the module declaration, which can be any custom file type. The default value is jsmodules: the modules to be combined, and multiple modules can be used, you can directly use the php Command to split the command line, for example, php smartcomb. the php-profile default-type js-modules pageA command directly outputs the concatenation result in the standard output and can generate files directly. Php smartcomb. php-profile default-type js-modules pageA> pageA-dep.js parameters are consistent with the web call method Thanks, please contact me for any questions :)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.