Security News
cURL Project and Go Security Teams Reject CVSS as Broken
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
metalsmith-jstransformer
Advanced tools
Metalsmith plugin to process files with any JSTransformer.
npm install --save metalsmith-jstransformer
If you are using the command-line version of Metalsmith, you can install via npm, and then add the metalsmith-jstransformer
key to your metalsmith.json
file:
{
"plugins": {
"metalsmith-jstransformer": {
"layoutPattern": "layouts/**",
"defaultLayout": null
}
}
}
If you are using the JS Api for Metalsmith, then you can require the module and add it to your .use()
directives:
var jstransformer = require('metalsmith-jstransformer');
metalsmith.use(jstransformer({
'layoutPattern': 'layouts/**',
'defaultLayout': null
}));
Create files that you would like to act on with JSTransformers with file extensions representing the transformer to use, in the format example.html.<transformer>
. For example, if you would like to process with Jade, you would name it src/example.html.jade
.
Use multiple transformers by appending additional file extension transformer names at the end. For example, to HTML-Minifier our Jade example above, you would use the filename src/example.html.html-minifier.jade
.
The following example uses Jade, so we must additionally install jstransformer-jade
:
npm install jstransformer-jade --save
src/example.html.jade
---
pageTitle: My Site
pretty: true
---
doctype html
html(lang="en")
head
title= pageTitle
body
p This is my site!
<!doctype html>
<html>
<head>
<title>My Site</title>
</head>
<body>
<p>This is my site!</p>
</body>
</html>
Declare layouts for your content with the extension of the template engine to be used for the layout, in the src/layouts/**
directory.
The following example uses Jade and Markdown-it, so we must additionally install jstransformer-jade
and jstransformer-markdown-it
:
npm install jstransformer-jade --save
npm install jstransformer-markdown-it --save
src/layouts/default.jade
---
pretty: true
---
doctype html
html
head
title My Site
body!= contents
Within the metadata of content in your src
directory, tell it which layout to use:
src/index.md
---
layout: layouts/default.jade
---
This is my **site**!
<!doctype html>
<html>
<head>
<title>My Site</title>
</head>
<body>
<p>This is my <strong>site</strong>!</p>
</body>
</html>
.layoutPattern
The pattern used to find your layouts. Defaults to layouts/**
.
.defaultLayout
If provided, will be used as the default layout for content that doesn't have a layout explicitly defined. Defaults to null
.
MIT
v0.7.2
FAQs
Metalsmith JSTransformer Plugin
The npm package metalsmith-jstransformer receives a total of 94 weekly downloads. As such, metalsmith-jstransformer popularity was classified as not popular.
We found that metalsmith-jstransformer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
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.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.