Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/adslot/express-pug-static
Connect (ExpressJS) middleware for serving pug files as static html
https://github.com/adslot/express-pug-static
adslot express hacktoberfest pug
Last synced: 3 months ago
JSON representation
Connect (ExpressJS) middleware for serving pug files as static html
- Host: GitHub
- URL: https://github.com/adslot/express-pug-static
- Owner: Adslot
- Fork: true (runk/connect-jade-static)
- Created: 2017-10-25T04:54:00.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2024-04-03T23:44:49.000Z (9 months ago)
- Last Synced: 2024-05-04T08:22:47.551Z (8 months ago)
- Topics: adslot, express, hacktoberfest, pug
- Language: JavaScript
- Homepage:
- Size: 254 KB
- Stars: 0
- Watchers: 17
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
express-pug-static
=============================================================================================================================================[![npm version](https://badge.fury.io/js/express-pug-static.svg)](https://badge.fury.io/js/express-pug-static)
![Build Status](https://github.com/Adslot/express-pug-static/actions/workflows/node.js.yml/badge.svg)
[![codecov](https://codecov.io/gh/Adslot/express-pug-static/branch/master/graph/badge.svg)](https://codecov.io/gh/Adslot/express-pug-static)Connect (ExpressJS) middleware for serving pug files as static html
## Installation
npm install express-pug-static
## Usage
Assume the following structure of your project:
/views
/partials
/file.pugLet's make pug files from `/views/partials` web accessible:
#### Express prior to 4.0
var pugStatic = require('express-pug-static');
app = express();
app.configure(function() {
app.use(pugStatic({
baseDir: path.join(__dirname, '/views/partials'),
baseUrl: '/partials',
maxAge: 86400,
pug: { pretty: true }
}));
});#### Express 4.0
var pugStatic = require('express-pug-static');
app = express();
app.use(pugStatic({
baseDir: path.join(__dirname, '/views/partials'),
baseUrl: '/partials',
maxAge: 86400,
pug: { pretty: true }
}));Now, if you start your web server and request `/partials/file.html` in browser you
should be able see the compiled pug template.-------------
by [http://adslot.com](http://adslot.com)