https://github.com/reshape/express
simple view engine config for express
https://github.com/reshape/express
Last synced: over 1 year ago
JSON representation
simple view engine config for express
- Host: GitHub
- URL: https://github.com/reshape/express
- Owner: reshape
- License: other
- Created: 2016-11-11T22:48:11.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-01-04T23:07:44.000Z (over 8 years ago)
- Last Synced: 2025-01-24T08:28:36.346Z (over 1 year ago)
- Language: JavaScript
- Size: 77.1 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: contributing.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Reshape Express
[](https://npmjs.com/package/reshape-express)
[](https://travis-ci.org/reshape/express?branch=master)
[](https://david-dm.org/reshape/express)
[](https://coveralls.io/r/reshape/express?branch=master)
An express view engine for reshape
> **Note:** This project is in early development, and versioning is a little different. [Read this](http://markup.im/#q4_cRZ1Q) 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:
```js
const express = require('express')
const reshape = require('reshape-express')
const standard = require('reshape-standard')
const app = express()
reshape(app, standard({ template: true }), 'html')
app.set('views', './views')
app.set('view engine', 'html')
app.get('/', (req, res) => {
res.render('index.html', { foo: 'bar' })
})
app.listen(3000)
```
And in `views/index.html`:
```jade
Test Page!
{{ foo }}
```
Should come out rendered correctly with locals and all. Whoo! 🎉
### License & Contributing
- Details on the license [can be found here](LICENSE.md)
- Details on running tests and contributing [can be found here](contributing.md)