Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hexo-renderer-pug

Package Overview
Dependencies
Maintainers
11
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hexo-renderer-pug - npm Package Compare versions

Comparing version 2.0.0 to 3.0.0

28

lib/pug.js
'use strict';
const path = require('path');
const pug = require('pug');
const configPath = path.join(process.cwd(), 'pug.config');
const defaultConfig = { compile: {} }; // avoids key errors
let hasConfig = true;
try {
require.resolve(configPath);
} catch {
hasConfig = false;
}
const config = hasConfig ? require(configPath) : defaultConfig;
// Validate non-standard keys -- e.g. 'compile'.
const hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
const invalidKeys = Object.keys(config).filter(k => !hasProp(defaultConfig, k));
if (invalidKeys.length > 0) {
throw Error(`Unsupported PUG config keys: ${invalidKeys.join(', ')}`);
}
function pugCompile(data) {
return pug.compile(data.text, {
filename: data.path
});
const opts = {
...config.compile,
filename: data.path // always used
};
return pug.compile(data.text, opts);
}

@@ -10,0 +32,0 @@

8

package.json
{
"name": "hexo-renderer-pug",
"version": "2.0.0",
"version": "3.0.0",
"description": "Pug renderer plugin for Hexo",

@@ -35,5 +35,5 @@ "main": "index.js",

"chai": "^4.3.4",
"eslint": "^7.25.0",
"eslint-config-hexo": "^4.1.0",
"mocha": "^8.3.2",
"eslint": "^8.4.0",
"eslint-config-hexo": "^5.0.0",
"mocha": "^9.2.0",
"nyc": "^15.1.0"

@@ -40,0 +40,0 @@ },

@@ -15,2 +15,17 @@ # hexo-renderer-pug

## Config
PugJS [options](https://pugjs.org/api/reference.html#options) are supported. These are the options passed into [compile()](https://pugjs.org/api/reference.html#pugcompilesource-options).
Create a `pug.config.js` in your project root:
```js
module.exports = {
compile: { // Passed to compile().
basedir: process.cwd(),
// ...Other options.
}
// No other methods are supported for now.
}
```
[Pug]: http://pugjs.org/
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc