express-pug-static

1.4.1 • Public • Published

express-pug-static

npm version Build Status codecov

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.pug

Let'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

Dependencies (1)

Dev Dependencies (2)

Package Sidebar

Install

npm i express-pug-static

Weekly Downloads

921

Version

1.4.1

License

MIT

Unpacked Size

17.1 kB

Total Files

15

Last publish

Collaborators

  • alexandria