GithubHelp home page GithubHelp logo

arty-ux / ms-layout-njk Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wernerglinka/ms-layout-njk

0.0 1.0 0.0 63 KB

metalsmith-layout and in-place with Nunjucks

Home Page: http://www.glinka.co/blog/metalsmith-layouts-nunjucks/

JavaScript 42.98% HTML 57.02%

ms-layout-njk's Introduction

A site to test metalsmith-layout, metalsmith-in-place and jstransformer-nunjucks

When you build static websites with Metalsmith it is very likely that you use the metalsmith-layout (ML) and metalsmith-in-place (MIP) plugins. If you are still using the old 1.x.x versions you may have tried to upgrade at one point to newer versions but found out that it was not a one-to-one replacement. Both plugin versions changed from using the Consolidation to the jsTransformer adapter plugin.  These adapters allow using different template engines through a normalized API.

I encountered an additional difficulty as I am using Nunjucks as the templating engine and I needed access to the Nunjucks environment to extend Nunjucks with custom filters.

For a thorough explanation see my blogpost Metalsmith, Layouts and Nunjucks

To understand the differences I built this repo.

The master branch is build with the latest plugin versions, metalsmith-layouts 2.1.0 and metalsmith-in-place 4.1.1, while the obsolete branch used metalsmith-layouts 1.6.5 and metalsmith-in-place 1.4.4 plus Nunjucks. The third branch, with_markdown uses a markdown source file.

Update 7/17/2018:

Added another branch in-place-only to demonstrate the use of metalsmith-in-place plugin without using metalsmith-layouts.

NOTE This will only work when using html in the source file. The use of metalsmith-in-place to render the page in a single step requires the inclusion of template code in the source file. Review src/index.njk in the in-place-only branch for an example. If Markdown is used in the source file this will not work as the html/nunjucks code will interfere with the markdown to html transformation.

  • Use metalsmith-in-place only when the source file uses html
  • Use metalsmith-in-place and metalsmith-layouts as demonstrated in branch with_markdown when the source file uses markdown

ms-layout-njk's People

Contributors

wernerglinka avatar wernerglinka-pr avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.