JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 54308
  • Score
    100M100P100Q146579F
  • License MIT

Assemble plugin (0.6+) for loading globs of views onto custom view collections. Also works with verb or other Templates.js based applications.

Package Exports

  • assemble-loader

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (assemble-loader) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

assemble-loader NPM version

Assemble plugin (0.6+) for loading globs of views onto custom view collections. Also works with verb or other Templates.js based applications.

Use this as a plugin for assemble, verb, or templates, or as an example for how to create your own assemble plugin!

(Table of contents generated by verb)

Install

Install with npm

$ npm i assemble-loader --save

Usage

var assemble = require('assemble');
var loader = require('assemble-loader');
var app = assemble()
  .use(loader());

// optionally pass glob patterns to the plugin
var app = assemble()
  .use(loader('foo/*.hbs'));

// and/or use the `.loadViews()` method added by the plugin
app.create('pages')
  .use(loader('foo/*.hbs'))
  .use(loader('bar/*.hbs'))
  .loadViews('baz/*.hbs')
  .loadViews('qux/*.hbs');

Collections

All collections

When the plugin is added to the app instance (as in the previous example), a .load method will also be added to every collection created.

var app = assemble()
  .use(loader());

// cache views on `app.views.posts`
app.create('posts')
  .load('content/*.md');

// cache views on `app.views.docs`
app.create('docs')
  .load('docs/*.md');

Specific collections

If you only want to add the loader to a specific collection, you can pass the plugin to the .use method on the collection.

var app = assemble();

// `create` returns the collection instance
app.create('posts')
  .use(loader())
  .load('content/*.md');

// this works too, since `create` adds methods to `app` 
// for the collection
app.posts
  .load('*.hbs')
  .load('*.txt');

Directly load templates

You can also skip the load method and just pass glob patterns directly to the plugin.

var app = assemble();

app.create('pages')
  .use(loader('*.hbs'))
  .use(loader('*.txt'))
  .use(loader('*.md'));
  • assemble: Static site generator for Grunt.js, Yeoman and Node.js. Used by Zurb Foundation, Zurb Ink, H5BP/Effeckt,… more | homepage
  • templates: System for creating and managing template collections, and rendering templates with any node.js template engine.… more | homepage
  • verb: Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used… more | homepage

Running tests

Install dev dependencies:

$ npm i -d && npm test

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Author

Jon Schlinkert

License

Copyright © 2015 Jon Schlinkert Released under the MIT license.


This file was generated by verb-cli on October 21, 2015.