wejsv2old-class-theme
v0.0.4
Published
We.js v2 theme class used to load themes
Downloads
4
Readme
we-class-theme
We.js class theme used to load one we.js theme from npm module
API
After all ... load the class
// load the class in your scripts
var Theme = require('we-class-theme');
Load one theme
// load the class in your scripts
var projectFolder = process.cwd();
var myTheme = new Theme(
'wejs-theme-default', // this is the npm module name of your theme
projectFolder // you need to pass the project folder where the npm_modules/wejs-theme-default npm package are instaled
);
For more infos check we.js theme engine for one example or how to use this class with sails.js, link: https://github.com/wejs/we-theme-engine/blob/master/lib/themeHook.js
Helpers
Sails Helpers avaible in theme class
render
/**
* Render one template with variables and template
*
* @param {object} req express js request
* @param {object} res express.js response
* @param {string} template the template name
* @param {object} data data passed to template
*/
// example:
theme.render(req, res, 'home/index');
Grunt helpers and all other helpers see
Check: https://github.com/wejs/we-class-theme/blob/master/lib/index.js
Links
- Example of one hook how uses this class : https://github.com/wejs/we-theme-engine/blob/master/lib/themeHook.js
- We.js main repo: https://github.com/wejs/we
- Default theme for we.js used in wejs.org: https://github.com/wejs/wejs-theme-default
Credits
Alberto Souza and contributors
License
MIT