static-combo-handler

    1.0.1 • Public • Published

    Static Combo Handler


    A static combo handler in NodeJS.

    Install

    npm i static-combo-handler
    

    Usage

    Express = require 'express'
    combo = require 'static-combo-handler'
    app = Express()
    opt = {
        "port": 3333,
        "assetsPath": "./path-to-static-files-dir",
        "combo_tag":"??",
        "combo_dir_tag":"__",
        "combo_mod_split":","
    }
    app.set 'port', process.env.PORT or opt.port
    app.use combo(opt)
    app.listen app.get('port')

    Test

    cd ./test
    npm install
    node test.js

    URL access as:

    <!-- combo css -->
    http://localhost:3333/??assets/css__common.css,index.css
    http://localhost:3333/??assets/css__common.css,index.css,v=2.1.1
    http://localhost:3333/??assets/css__common.css,index.css__v=2.1.1
    <!-- debug -->
    http://localhost:3333/??assets/css__common.css,index.css__debug
    http://localhost:3333/??assets/css__common.css,index.css,v=2.1.1__debug
    http://localhost:3333/??assets/css__common.css,index.css__v=2.1.1__debug
    <!-- or -->
    http://localhost:3333/??assets_css__common.css,index.css
    http://localhost:3333/??assets__css/common.css,css/index.css
     
     
    <!-- combo javascript -->
    http://localhost:3333/??assets/js__jquery.js,vmcore.js
    http://localhost:3333/??assets/js__jquery.js,vmcore.js,v=2.1.1
    http://localhost:3333/??assets/js__jquery.js,vmcore.js__v=2.1.1
    <!-- debug -->
    http://localhost:3333/??assets/js__jquery.js,vmcore.js__debug
    http://localhost:3333/??assets/js__jquery.js,vmcore.js,v=2.1.1__debug
    http://localhost:3333/??assets/js__jquery.js,vmcore.js__v=2.1.1__debug
    <!-- or -->
    http://localhost:3333/??assets_js__jquery.js,vmcore.js
    http://localhost:3333/??assets__js/jquery.js,js/vmcore.js
     
     
    <!-- no combo -->
    http://localhost:3333/assets/js/jquery.js
    http://localhost:3333/assets/css/index.js
    http://localhost:3333/assets/img/cool.png

    Install

    npm i static-combo-handler

    DownloadsWeekly Downloads

    3

    Version

    1.0.1

    License

    MIT

    Last publish

    Collaborators

    • lmtidt