🚀 Launch Week Day 3:Introducing Supply Chain Attack Campaigns Tracking.Learn More →
Socket
Book a DemoInstallSign in
Socket

helper-glob

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

helper-glob

Template helper for globbing files. Works with handlebars, Lo-Dash or any template engine that supports helper functions.

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

helper-glob NPM version

Template helper for globbing files. Works with handlebars, Lo-Dash or any template engine that supports helper functions.

Install with npm

npm i helper-glob --save

Usage

Lo-Dash

var _ = require('lodash');

_.template('<%= glob("files/*.txt") %>', {
  glob: require('helper-glob')
});

// glob and read files
var fs = require('fs');
_.template('<%= _.map(glob("files/*.txt"), read) %>', {
  glob: require('helper-glob'),
  read: function(fp) {
    return fs.readFileSync(fp, 'utf8');
  }
});

Handlebars

var handlebars = require('handlebars');
var fs = require('fs');

handlebars.registerHelper('glob', require('helper-glob'));
handlebars.registerHelper('read', function(fp) {
  return fs.readFileSync(fp, 'utf8');
});
{{glob 'files/*.txt'}}

<!-- glob and read files using subexpressions -->
{{#each (glob "files/*.hbs")}}
  {{read .}}
{{/each}}

Author

Jon Schlinkert

License

Copyright (c) 2014 Jon Schlinkert
Released under the MIT license

This file was generated by verb on December 06, 2014. To update, run npm i -g verb && verb.

Keywords

expand

FAQs

Package last updated on 07 Dec 2014

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