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

metalsmith-layouts

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

metalsmith-layouts

A metalsmith plugin for layouts.

  • 1.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.6K
decreased by-24.84%
Maintainers
1
Weekly downloads
 
Created
Source

metalsmith-layouts

npm Build Status Dependency Status devDependency Status npm

A metalsmith plugin for layouts

This plugin passes your source files to a template as contents and renders them with the templating engine of your choice. You can use any templating engine supported by consolidate.js. Pass options to metalsmith-layouts with the Javascript API or CLI. The options are:

  • engine: templating engine (required)
  • default: default template (optional)
  • directory: directory for the layouts, layouts by default (optional)
  • pattern: only files that match this pattern will be processed (optional)

Any unrecognised options will be passed on to consolidate.js. You can use this, for example, to disable caching by passing cache: false to consolidate. See the consolidate.js documentation for all available options.

Installation

$ npm install metalsmith-layouts

Example

Configuration in metalsmith.json:

{
  "plugins": {
    "metalsmith-layouts": {
      "engine": "handlebars"
    }
  }
}

Source file src/index.html:

---
layout: layout.html
title: The title
---
<p>The contents</p>

Layout layouts/layout.html:

<!doctype html>
<html>
<head>
  <title>{{title}}</title>
</head>
<body>
{{{contents}}}
</body>
</html>

Results in dist/index.html:

<!doctype html>
<html>
<head>
  <title>The title</title>
</head>
<body>
  <p>The contents</p>
</body>
</html>

Origins

This plugin is a fork of metalsmith-templates. Splitting up metalsmith-templates into two plugins was suggested by Ian Storm Taylor. The results are:

License

MIT

FAQs

Package last updated on 25 Jul 2015

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

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