x-views

0.0.6 • Public • Published

x-views

A wrapper module of the express-handlebars for x-css.

[![npm version][npm-badge]][npm] [![dependency status][dep-badge]][dep-status]

Installation

Install using npm:

$ npm install x-views

Usage

Same ways to use the express-handlebars:

app.js:

var express = require('express');
var x-views = require('x-views');
 
var app = express();
var xv = x-views({
    defaultLayout: 'main',
    extname: '.hbs'
});
 
app.engine('hbs', xv.engine);
app.set('view engine', 'hbs');
 
app.get('/', function (req, res) {
    res.render('home');
});
 
app.listen(3000);

views/layouts/main.hbs:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Example App</title>
</head>
<body>
 
    {{{body}}}
 
</body>
</html>

views/home.hbs:

<h1>Example App: Home</h1>

What will happen?

You can see the <style></style> tag at the end of HTML when you right-click on your browser to see the page source code.

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Example App</title>
</head>
<body>
 
 <h1>Example App: Home</h1>
 
<style></style>
</body>
</html>

Note: The style tag is inserted by x-views according to x-css rules. That is the x-views' mission.

License

MIT

Package Sidebar

Install

npm i x-views

Weekly Downloads

2

Version

0.0.6

License

MIT

Last publish

Collaborators

  • nohsenc