Skip to content

clemsos/metalsmith-scan-images

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 

Metalsmith Scan Images

A metalsmith plugin to easily create image galleries.

This plugin will scan all images included in folders following a pattern (ex 'content/projects/**/*.md') and add an array of paths called images to each post metadata.

Supported extensions : "jpg", "svg", "png", "gif", "JPG", "SVG", "PNG", "GIF"

Install

npm install --save metalsmith-scan-images

API

var Metalsmith = require('metalsmith');
var images = require("metalsmith-scan-images");

var metalsmith = new Metalsmith(__dirname)
  .use(images( 'content/**/**/index.html' ))

Use it

A basic example of template for an image gallery

<div id="gallery" class="nine columns">
    <ul >
    {{#each images }}
        <li>
            <img src="{{this}}" alt="">
        </li>
    {{/each}}
    </ul>
</div>

About

A metalsmith plugin that scan all images in subfolders and add it to metadata.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published