Skip to content

DEPRECATED A Metalsmith plugin that adds files mtimes to their metadata

License

Notifications You must be signed in to change notification settings

jkuczm/metalsmith-mtime

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DEPRECATED

This plugin is deprecated, its functionality is now fully integrated into Metalsmith core.

Since version 0.10.0 Metalsmith adds full file stats to metadata. If you're using metalsmith-mtime with 0.10, or newer, version of Metalsmith, replace mtime, in your code, with stats.mtime and remove "metalsmith-mtime" from dependencies.

metalsmith-mtime

A Metalsmith plugin that adds files last modification times to their Metalsmith metadata.

Build Status Coverage Status npm version Dependency Status devDependency Status License MIT

This plugin iterates over Metalsmith files and adds mtime property to metadata of each entry in files that corresponds to file existing in filesystem. Value of this property is an instance of Date representing files last modification time.

mtime property can be used e.g. in a template (here we use swig):

Last modified: {{ mtime|date('Y.m.d H:i') }}

Installation

$ npm install metalsmith-mtime

Usage

JavaScript

var mtime = require('metalsmith-mtime');

metalsmith.use(mtime()));

CLI

Add the metalsmith-mtime key to your metalsmith.json plugins:

{
  "plugins": {
    "metalsmith-mtime": true
  }
}

Tips

If you keep source code of your website in Git, be aware that Git does not store file mtimes. So to use this plugin you would also need one of additional tools for handling metadata in Git.

About

DEPRECATED A Metalsmith plugin that adds files mtimes to their metadata

Resources

License

Stars

Watchers

Forks

Packages

No packages published