New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

pug-cache

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pug-cache

A clean, whitespace-sensitive template language for writing HTML

latest
Source
npmnpm
Version
2.0.14
Version published
Maintainers
1
Created
Source

Pug

Full documentation is at pugjs.org

load src of template that included or extended from cache

example

examples/includes.js

examples/includes.pug


/**
 * Module dependencies.
 */

var pug = require('../')
  , path = __dirname + '/includes.pug'
  , str = require('fs').readFileSync(path, 'utf8')

console.time("l")
let options = {
  filename: "includes.pug",
  pretty: true,
  loadFromStrArr:
    [
      { name: "head.pug", content: "head\n  title My Site [[[ LOAD FROM STRING ARRAY ]]] \n  // including other pug works\n  include scripts.pug\n  // including .html, .css, etc works\n  include style.css\n" },
      { name: "includes.pug", content: "\nhtml\n  include includes/head.pug\n  body\n    h1 My Site\n    p Welcome to my super lame site.\n    include includes/foot.pug\n" },
      { name: "foot.pug", content: "#footer\n  p Copyright (c) foobar\n  each product in products\n    div=product" },
      { name: "scripts.pug", content: "script(src=\'/javascripts/jquery.js\')\nscript(src=\'/javascripts/app.js\')\n" },
      { name: "style.css", content: "<style>\n  body {\n    padding: 50px;\n  }\n</style>" }
    ],
  userData: { products: [1, 2, 4] }
}
var fn = pug.compile(str, options);
console.log(fn({ products: [1, 2, 4] }));
console.timeEnd("l")
/* <html>
  <head>
    <title>My Site [[[ LOAD FROM STRING ARRAY ]]] </title>
    <!-- including other pug works-->
    <script src="/javascripts/jquery.js"></script>
    <script src="/javascripts/app.js"></script>
    <!-- including .html, .css, etc works--><style>
  body {
    padding: 50px;
  }
</style>
  </head>
  <body>
    <h1>My Site</h1>
    <p>Welcome to my super lame site.</p>
    <div id="footer">
      <p>Copyright (c) foobar</p>
    </div>
  </body>
</html>
*/

License

MIT

Keywords

html

FAQs

Package last updated on 20 May 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts