reshape-express
v1.0.0
Published
Express plugin for reshape
Downloads
4
Readme
Reshape Express
An express view engine for reshape
Note: This project is in early development, and versioning is a little different. Read this for more details.
Installation
npm install reshape-express -S
Note: This project is compatible with node v6+ only
Usage
Require it and run the exported function, passing it your express app
and your reshape options, plugins, etc. It will match .html
files by default, you can pass an alternate file type as the third argument if you want.
Then set up your views directory and view engine, and pass in any locals when you run res.render
. That's it! Example below:
const express = require('express')
const reshape = require('reshape-express')
const standard = require('reshape-standard')
const app = express()
reshape(app, standard(), 'sgr')
app.set('views', './views')
app.set('view engine', 'sgr')
app.get('/', (req, res) => {
res.render('index.sgr', { foo: 'bar' })
})
app.listen(3000)
And in views/index.sgr
:
h1 Test Page!
p {{ foo }}
Should come out rendered correctly with locals and all. Whoo! 🎉
License & Contributing
- Details on the license can be found here
- Details on running tests and contributing can be found here