Smartcomb: web module splitters implemented using php. smartcombweb_PHP tutorial

Source: Internet
Author: User
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:

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.