1.5.1 • Published 5 months ago

express-pug-static v1.5.1

Weekly downloads
939
License
MIT
Repository
github
Last release
5 months ago

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

1.5.1

5 months ago

1.5.0

8 months ago

1.4.2

1 year ago

1.4.1

1 year ago

1.4.0

2 years ago

1.3.0

3 years ago

1.2.0

4 years ago

1.1.0

4 years ago

1.0.0

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

8 years ago