wejsv2old-class-theme

We.js v2 theme class used to load themes

Usage no npm install needed!

<script type="module">
  import wejsv2oldClassTheme from 'https://cdn.skypack.dev/wejsv2old-class-theme';
</script>

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

Credits

Alberto Souza and contributors

License

MIT