0.0.3 • Published 10 years ago

twee-view-extension v0.0.3

Weekly downloads
3
License
MIT
Repository
github
Last release
10 years ago

twee-view-extension

Twee.io Logo

Gitter npm npm

View engines and helpers middleware extension for Twee.io Framework - MVC Framework for Node.js based on Express.js

Includes: consolidate to abstragate from view engines realisations with possibility to customize initialization of engines via config; express-promise to use promises in views; underscore and lodash as helpers.

To install it use this command:

npm install twee-view-extension --save

Editing package.json of your application:

"dependencies": {
    "twee-view-extension": "*",
    "jade": "*"
    // or: "swig" ... etc
}

Turning extension ON in application/configs/twee.js:

module.exports = {
    "extensions": {
        "View Engines": {
            "module": "twee-view-extension"
        }
    }
};

Default Config:

{
    "engines": {
        "swig": {
            "fileExt": "html",
            "options": {
                "cache": (app.get('env') === 'development' ? false : 'memory')
            },
            "disabled": false
        }
    },
    "appDefaultEngine": "html",
    "disabled": false
}

You're able to add more key-values like swig and init options for each engine

You can rewrite default config right in application/configs/twee.js:

{
    "extension": {
        "twee-view": {
            "engines": {
                // ...
            }
        }
    }
}