Home

Awesome

<p align="center"> <a href="https://github.com/assemble/assemble"> <img height="250" width="250" src="https://raw.githubusercontent.com/assemble/assemble-core/master/docs/logo.png"> </a> </p>

assemble-core

NPM version NPM monthly downloads Build Status Gitter

Built on top of base and templates, assemble-core is used in assemble to provide the baseline features and API necessary for rendering templates, working with the file system, and running tasks.

Implementors and hackers can use assemble-core to create rich and powerful build tooling, project scaffolding systems, documentation generators, or even your completely custom static site generators.

<details> <summary><strong>Table of contents</strong></summary> - [What can I do with assemble-core?](#what-can-i-do-with-assemble-core) - [Install](#install) - [Install](#install-1) - [Usage](#usage) - [Examples](#examples) - [API](#api) * [File System API](#file-system-api) + [.src](#src) + [.dest](#dest) + [.copy](#copy) + [.symlink](#symlink) * [Task API](#task-api) + [.task](#task) + [.build](#build) + [.watch](#watch) - [FAQ](#faq) - [Toolkit suite](#toolkit-suite) - [About](#about) * [Related projects](#related-projects) * [Tests](#tests) * [Contributing](#contributing) * [Release History](#release-history) * [Authors](#authors) * [License](#license)

(TOC generated by verb using markdown-toc)

</details>

What can I do with assemble-core?

Create your own:

Install

NPM

Install

Install with npm:

$ npm install --save assemble-core

yarn

Install with yarn:

$ yarn add assemble-core && yarn upgrade

Usage

var assemble = require('assemble-core');
var app = assemble();

Examples

view collections

Create a custom view collection:

var app = assemble();
app.create('pages');

Now you can add pages with app.page() or app.pages():

app.page('home.hbs', {content: 'this is the home page!'});

render

Render a view:

var app = assemble();

var view = app.view('foo', {content: 'Hi, my name is <%= name %>'});

app.render(view, { name: 'Brian' }, function(err, res) {
  console.log(res.content);
  //=> 'Hi, my name is Brian'
});

Render a view from a collection:

var app = assemble();
app.create('pages');

app.page('foo', {content: 'Hi, my name is <%= name %>'})
  .set('data.name', 'Brian')
  .render(function (err, res) {
    console.log(res.content);
    //=> 'Hi, my name is Brian'
  });

API

Assemble

Create an assemble application. This is the main function exported by the assemble module.

Params

Example

var assemble = require('assemble');
var app = assemble();

File System API

Assemble has the following methods for working with the file system:

Assemble v0.6.0 has full vinyl-fs support, so any gulp plugin should work with assemble.

.src

Use one or more glob patterns or filepaths to specify source files.

Params

Example

app.src('src/*.hbs', {layout: 'default'});

.dest

Specify the destination to use for processed files.

Params

Example

app.dest('dist/');

.copy

Copy files from A to B, where A is any pattern that would be valid in app.src and B is the destination directory.

Params

Example

app.copy('assets/**', 'dist/');

.symlink

Glob patterns or paths for symlinks.

Params

Example

app.symlink('src/**');

Task API

Assemble has the following methods for running tasks and controlling workflows:

.task

Define a task. Tasks are functions that are stored on a tasks object, allowing them to be called later by the build method. (the CLI calls build to run tasks)

Params

Example

app.task('default', function() {
  return app.src('templates/*.hbs')
    .pipe(app.dest('dist/'));
});

.build

Run one or more tasks.

Params

Example

app.build(['foo', 'bar'], function(err) {
  if (err) console.error('ERROR:', err);
});

.watch

Watch files, run one or more tasks when a watched file changes.

Params

Example

app.task('watch', function() {
  app.watch('docs/*.md', ['docs']);
});

FAQ

How does assemble-core differ from assemble?

featureassemble-coreassemblenotes
front-matter parsingNoYesuse assemble or use parser-front-matter as an .onLoad middleware.
CLINoYesCreate your own CLI experience, or use assemble
Built-in template collectionsNoYesUse .create() to add collections
Built-in template engineNoYesassemble ships with engine-handlebars. Use .engine() to register any consolidate-compatible template engine.

Toolkit suite

assemble-core is a standalone application that was created using applications and plugins from the toolkit suite:

Building blocks

Plugins

About

Related projects

Assemble is built on top of these great projects:

Tests

Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:

$ npm install && npm test

Contributing

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

Please read the contributing guide for advice on opening issues, pull requests, and coding standards.

If Assemble doesn't do what you need, please let us know.

Release History

key

Changelog entries are classified using the following labels from keep-a-changelog:

Custom labels used in this changelog:

Heads up!

Please let us know if any of the following heading links are broken. Thanks!

0.31.0 - 2017-02-11

dependencies

0.30.0 - 2017-08-01

dependencies

0.29.0 - 2017-02-01

dependencies

0.28.0 - 2017-02-01

dependencies

0.27.0 - 2016-12-27

dependencies

0.26.0 - 2016-08-06

dependencies

0.25.0 - 2016-07-05

changed

0.24.0

dependencies

removed

0.23.0

fixed

0.22.0

dependencies

fixed

changed

0.21.0

dependencies

removed

0.20.0

dependencies

changed

0.19.0

dependencies

housekeeping

0.18.0

dependencies

0.17.0

dependencies

0.16.0

dependencies

0.15.0

dependencies

0.14.0

dependencies

deprecated

changed

added

0.13.0

0.9.0

0.8.0

0.7.0

0.6.0

0.5.0

[0.4.0]

(Changelog generated by helper-changelog)

Authors

Jon Schlinkert

Brian Woodward

License

Copyright © 2017, Jon Schlinkert. MIT


This file was generated by verb-generate-readme, v0.4.2, on February 11, 2017.