├── .editorconfig
├── .eslintrc.json
├── .gitattributes
├── .github
└── contributing.md
├── .gitignore
├── .travis.yml
├── .verb.md
├── LICENSE
├── README.md
├── changelog.md
├── docs
├── logo.png
└── src
│ ├── overview.md
│ └── recipes
│ └── assemblefile.md
├── gulpfile.js
├── index.js
├── package.json
├── test
└── _suite.js
└── utils.js
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | indent_style = space
5 | end_of_line = lf
6 | charset = utf-8
7 | indent_size = 2
8 | trim_trailing_whitespace = true
9 | insert_final_newline = true
10 |
11 | [{**/{actual,fixtures,expected,templates}/**,*.md}]
12 | trim_trailing_whitespace = false
13 | insert_final_newline = false
--------------------------------------------------------------------------------
/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "ecmaFeatures": {
3 | "modules": true,
4 | "experimentalObjectRestSpread": true
5 | },
6 |
7 | "env": {
8 | "browser": false,
9 | "es6": true,
10 | "node": true,
11 | "mocha": true
12 | },
13 |
14 | "globals": {
15 | "document": false,
16 | "navigator": false,
17 | "window": false
18 | },
19 |
20 | "rules": {
21 | "accessor-pairs": 2,
22 | "arrow-spacing": [2, { "before": true, "after": true }],
23 | "block-spacing": [2, "always"],
24 | "brace-style": [2, "1tbs", { "allowSingleLine": true }],
25 | "comma-dangle": [2, "never"],
26 | "comma-spacing": [2, { "before": false, "after": true }],
27 | "comma-style": [2, "last"],
28 | "constructor-super": 2,
29 | "curly": [2, "multi-line"],
30 | "dot-location": [2, "property"],
31 | "eol-last": 2,
32 | "eqeqeq": [2, "allow-null"],
33 | "generator-star-spacing": [2, { "before": true, "after": true }],
34 | "handle-callback-err": [2, "^(err|error)$" ],
35 | "indent": [2, 2, { "SwitchCase": 1 }],
36 | "key-spacing": [2, { "beforeColon": false, "afterColon": true }],
37 | "keyword-spacing": [2, { "before": true, "after": true }],
38 | "new-cap": [2, { "newIsCap": true, "capIsNew": false }],
39 | "new-parens": 2,
40 | "no-array-constructor": 2,
41 | "no-caller": 2,
42 | "no-class-assign": 2,
43 | "no-cond-assign": 2,
44 | "no-const-assign": 2,
45 | "no-control-regex": 2,
46 | "no-debugger": 2,
47 | "no-delete-var": 2,
48 | "no-dupe-args": 2,
49 | "no-dupe-class-members": 2,
50 | "no-dupe-keys": 2,
51 | "no-duplicate-case": 2,
52 | "no-empty-character-class": 2,
53 | "no-eval": 2,
54 | "no-ex-assign": 2,
55 | "no-extend-native": 2,
56 | "no-extra-bind": 2,
57 | "no-extra-boolean-cast": 2,
58 | "no-extra-parens": [2, "functions"],
59 | "no-fallthrough": 2,
60 | "no-floating-decimal": 2,
61 | "no-func-assign": 2,
62 | "no-implied-eval": 2,
63 | "no-inner-declarations": [2, "functions"],
64 | "no-invalid-regexp": 2,
65 | "no-irregular-whitespace": 2,
66 | "no-iterator": 2,
67 | "no-label-var": 2,
68 | "no-labels": 2,
69 | "no-lone-blocks": 2,
70 | "no-mixed-spaces-and-tabs": 2,
71 | "no-multi-spaces": 2,
72 | "no-multi-str": 2,
73 | "no-multiple-empty-lines": [2, { "max": 1 }],
74 | "no-native-reassign": 0,
75 | "no-negated-in-lhs": 2,
76 | "no-new": 2,
77 | "no-new-func": 2,
78 | "no-new-object": 2,
79 | "no-new-require": 2,
80 | "no-new-wrappers": 2,
81 | "no-obj-calls": 2,
82 | "no-octal": 2,
83 | "no-octal-escape": 2,
84 | "no-proto": 0,
85 | "no-redeclare": 2,
86 | "no-regex-spaces": 2,
87 | "no-return-assign": 2,
88 | "no-self-compare": 2,
89 | "no-sequences": 2,
90 | "no-shadow-restricted-names": 2,
91 | "no-spaced-func": 2,
92 | "no-sparse-arrays": 2,
93 | "no-this-before-super": 2,
94 | "no-throw-literal": 2,
95 | "no-trailing-spaces": 0,
96 | "no-undef": 2,
97 | "no-undef-init": 2,
98 | "no-unexpected-multiline": 2,
99 | "no-unneeded-ternary": [2, { "defaultAssignment": false }],
100 | "no-unreachable": 2,
101 | "no-unused-vars": [2, { "vars": "all", "args": "none" }],
102 | "no-useless-call": 0,
103 | "no-with": 2,
104 | "one-var": [0, { "initialized": "never" }],
105 | "operator-linebreak": [0, "after", { "overrides": { "?": "before", ":": "before" } }],
106 | "padded-blocks": [0, "never"],
107 | "quotes": [2, "single", "avoid-escape"],
108 | "radix": 2,
109 | "semi": [2, "always"],
110 | "semi-spacing": [2, { "before": false, "after": true }],
111 | "space-before-blocks": [2, "always"],
112 | "space-before-function-paren": [2, "never"],
113 | "space-in-parens": [2, "never"],
114 | "space-infix-ops": 2,
115 | "space-unary-ops": [2, { "words": true, "nonwords": false }],
116 | "spaced-comment": [0, "always", { "markers": ["global", "globals", "eslint", "eslint-disable", "*package", "!", ","] }],
117 | "use-isnan": 2,
118 | "valid-typeof": 2,
119 | "wrap-iife": [2, "any"],
120 | "yoda": [2, "never"]
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Enforce Unix newlines
2 | * text eol=lf
3 |
4 | # binaries
5 | *.ai binary
6 | *.psd binary
7 | *.jpg binary
8 | *.gif binary
9 | *.png binary
10 | *.jpeg binary
11 |
--------------------------------------------------------------------------------
/.github/contributing.md:
--------------------------------------------------------------------------------
1 | # Contributing to Assemble
2 |
3 | First and foremost, thank you! We appreciate that you want to contribute to Assemble, your time is valuable, and your contributions mean a lot to us.
4 |
5 | **What does "contributing" mean?**
6 |
7 | Creating an issue is the simplest form of contributing to a project. But there are many ways to contribute, including the following:
8 |
9 | - Updating or correcting documentation
10 | - Feature requests
11 | - Bug reports
12 |
13 | ## Issues
14 |
15 | **Before creating an issue**
16 |
17 | Please make sure you're creating one in the right place:
18 |
19 | - do you have a template syntax question? Like how to accomplish something with handlebars? The best place to get answers for this is [stackoverflow.com][], the [handlebars docs](handlebarsjs.com), or the documentation for the template engine you're using.
20 | - Are you having an issue with an Assemble feature that is powered by an underlying lib? This is sometimes difficult to know, but sometimes it can be pretty easy to find out. For example, if you use a glob pattern somewhere and you found what you believe to be a matching bug, that would probably be an issue for [node-glob][] or [micromatch][]
21 |
22 | **Creating an issue**
23 |
24 | Please be as descriptive as possible when creating an issue. Give us the information we need to successfully answer your question or address your issue by answering the following in your issue:
25 |
26 | - what version of assemble are you using?
27 | - is the issue helper-related? If so, this issue should probably be opened on the repo related to the helper being used.
28 | - do you have any custom helpers defined? Is the issue related to the helper itself, data (context) being passed to the helper, or actually registering the helper in the first place?
29 | - are you using middleware?
30 | - any plugins?
31 |
32 |
33 | ## Above and beyond
34 |
35 | Here are some tips for creating idiomatic issues. Taking just a little bit extra time will make your issue easier to read, easier to resolve, more likely to be found by others who have the same or similar issue in the future.
36 |
37 | - take some time to learn basic markdown. This [markdown cheatsheet](https://gist.github.com/jonschlinkert/5854601) is super helpful, as is the GitHub guide to [basic markdown](https://help.github.com/articles/markdown-basics/).
38 | - Learn about [GitHub Flavored Markdown](https://help.github.com/articles/github-flavored-markdown/). And if you want to really go above and beyond, read [mastering markdown](https://guides.github.com/features/mastering-markdown/).
39 | - use backticks to wrap code. This ensures that code will retain its format, making it much more readable to others
40 | - use syntax highlighting by adding the correct language name after the first "code fence"
41 |
42 | [node-glob]: https://github.com/isaacs/node-glob
43 | [micromatch]: https://github.com/jonschlinkert/micromatch
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # always ignore files
2 | *.DS_Store
3 | *.sublime-*
4 |
5 | # test related, or directories generated by tests
6 | test/actual
7 | actual
8 | coverage
9 | .nyc*
10 |
11 | # npm
12 | node_modules
13 | npm-debug.log
14 |
15 | # yarn
16 | yarn.lock
17 | yarn-error.log
18 |
19 | # misc
20 | _gh_pages
21 | _draft
22 | _drafts
23 | bower_components
24 | vendor
25 | temp
26 | tmp
27 | TODO.md
28 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | sudo: false
2 | os:
3 | - linux
4 | - osx
5 | language: node_js
6 | node_js:
7 | - node
8 | - '6'
9 | - '4'
10 | matrix:
11 | allow_failures:
12 | - node_js: '4'
13 | - node_js: '0.12'
14 | - node_js: '0.10'
15 |
--------------------------------------------------------------------------------
/.verb.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | # {%= name %}
8 |
9 | {%= badge("npm") %} {%= badge('downloads') %} {%= ifExists(["test", "test.js"], badge('travis')) %} {%= badge('gitter') %}
10 |
11 | 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.
12 |
13 | 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.
14 |
15 |
16 | Table of contents
17 |
18 |
19 |
20 | ## What can I do with assemble-core?
21 |
22 | Create your own:
23 |
24 | - blog engine
25 | - project generator / scaffolder
26 | - e-book development framework
27 | - build system
28 | - landing page generator
29 | - documentation generator
30 | - front-end UI framework
31 | - rapid prototyping framework
32 | - static site generator
33 | - web application
34 |
35 | ## Install
36 |
37 | **NPM**
38 |
39 | ## Install
40 |
41 | {%= include("install-npm", {save: true}) %}
42 |
43 | **yarn**
44 |
45 | Install with [yarn](yarnpkg.com):
46 |
47 | ```sh
48 | $ yarn add assemble-core && yarn upgrade
49 | ```
50 |
51 | ## Usage
52 |
53 | ```js
54 | var assemble = require('{%= name %}');
55 | var app = assemble();
56 | ```
57 |
58 | ## Examples
59 |
60 | **view collections**
61 |
62 | Create a custom view collection:
63 |
64 | ```js
65 | var app = assemble();
66 | app.create('pages');
67 | ```
68 |
69 | Now you can add pages with `app.page()` or `app.pages()`:
70 |
71 | ```js
72 | app.page('home.hbs', {content: 'this is the home page!'});
73 | ```
74 |
75 | **render**
76 |
77 | Render a view:
78 |
79 | ```js
80 | var app = assemble();
81 |
82 | var view = app.view('foo', {content: 'Hi, my name is <%= name %>'});
83 |
84 | app.render(view, { name: 'Brian' }, function(err, res) {
85 | console.log(res.content);
86 | //=> 'Hi, my name is Brian'
87 | });
88 | ```
89 |
90 | Render a view from a collection:
91 |
92 | ```js
93 | var app = assemble();
94 | app.create('pages');
95 |
96 | app.page('foo', {content: 'Hi, my name is <%= name %>'})
97 | .set('data.name', 'Brian')
98 | .render(function (err, res) {
99 | console.log(res.content);
100 | //=> 'Hi, my name is Brian'
101 | });
102 | ```
103 |
104 | ## API
105 | {%= apidocs("index.js") %}
106 |
107 |
108 | ***
109 |
110 | ### File System API
111 |
112 | Assemble has the following methods for working with the file system:
113 |
114 | - [src](#src)
115 | - [dest](#dest)
116 | - [copy](#copy)
117 | - [symlink](#symlink)
118 |
119 | Assemble v0.6.0 has full [vinyl-fs][] support, so any [gulp][] plugin should work with assemble.
120 |
121 | #### .src
122 |
123 | Use one or more glob patterns or filepaths to specify source files.
124 |
125 | **Params**
126 |
127 | * `glob` **{String|Array}**: Glob patterns or file paths to source files.
128 | * `options` **{Object}**: Options or locals to merge into the context and/or pass to `src` plugins
129 |
130 | **Example**
131 |
132 | ```js
133 | app.src('src/*.hbs', {layout: 'default'});
134 | ```
135 |
136 | #### .dest
137 |
138 | Specify the destination to use for processed files.
139 |
140 | **Params**
141 |
142 | * `dest` **{String|Function}**: File path or custom renaming function.
143 | * `options` **{Object}**: Options and locals to pass to `dest` plugins
144 |
145 | **Example**
146 |
147 | ```js
148 | app.dest('dist/');
149 | ```
150 |
151 | #### .copy
152 |
153 | Copy files from A to B, where `A` is any pattern that would be valid in [app.src](#src) and `B` is the destination directory.
154 |
155 | **Params**
156 |
157 | * `patterns` **{String|Array}**: One or more file paths or glob patterns for the source files to copy.
158 | * `dest` **{String|Function}**: Desination directory.
159 | * `returns` **{Stream}**: The stream is returned, so you can continue processing files if necessary.
160 |
161 | **Example**
162 |
163 | ```js
164 | app.copy('assets/**', 'dist/');
165 | ```
166 |
167 | #### .symlink
168 |
169 | Glob patterns or paths for symlinks.
170 |
171 | **Params**
172 |
173 | * `glob` **{String|Array}**
174 |
175 | **Example**
176 |
177 | ```js
178 | app.symlink('src/**');
179 | ```
180 |
181 | ***
182 |
183 | ### Task API
184 |
185 | Assemble has the following methods for running tasks and controlling workflows:
186 |
187 | - [task](#task)
188 | - [build](#build)
189 | - [watch](#watch)
190 |
191 | #### .task
192 |
193 | Define a task. Tasks are functions that are stored on a `tasks` object, allowing them to be called later by the [build](#build) method. (the [CLI][assemble-cli] calls [build](#build) to run tasks)
194 |
195 | **Params**
196 |
197 | * `name` **{String}**: Task name
198 | * `fn` **{Function}**: function that is called when the task is run.
199 |
200 | **Example**
201 |
202 | ```js
203 | app.task('default', function() {
204 | return app.src('templates/*.hbs')
205 | .pipe(app.dest('dist/'));
206 | });
207 | ```
208 |
209 | #### .build
210 |
211 | Run one or more tasks.
212 |
213 | **Params**
214 |
215 | * `tasks` **{Array|String}**: Task name or array of task names.
216 | * `cb` **{Function}**: callback function that exposes `err`
217 |
218 | **Example**
219 |
220 | ```js
221 | app.build(['foo', 'bar'], function(err) {
222 | if (err) console.error('ERROR:', err);
223 | });
224 | ```
225 |
226 | #### .watch
227 |
228 | Watch files, run one or more tasks when a watched file changes.
229 |
230 | **Params**
231 |
232 | * `glob` **{String|Array}**: Filepaths or glob patterns.
233 | * `tasks` **{Array}**: Task(s) to watch.
234 |
235 | **Example**
236 |
237 | ```js
238 | app.task('watch', function() {
239 | app.watch('docs/*.md', ['docs']);
240 | });
241 | ```
242 |
243 | ## FAQ
244 |
245 | **How does assemble-core differ from [assemble][]?**
246 |
247 | **feature** | **assemble-core** | **assemble** | **notes**
248 | --- | :---: | :---: | ---
249 | front-matter parsing | No | Yes | use [assemble][] or use [parser-front-matter][] as an `.onLoad` middleware.
250 | CLI | No | Yes | Create your own CLI experience, or use [assemble][]
251 | Built-in template collections | No | Yes | Use `.create()` to add collections
252 | Built-in template engine | No | Yes | [assemble][] ships with [engine-handlebars][]. Use `.engine()` to register any [consolidate][]-compatible template engine.
253 |
254 | ## Toolkit suite
255 |
256 | assemble-core is a standalone application that was created using applications and plugins from the [toolkit suite](https://github.com/node-toolkit/getting-started):
257 |
258 | **Building blocks**
259 |
260 | - [base][]: framework for rapidly creating high quality node.js applications, using plugins like building blocks.
261 | - [templates][]: used to create the foundation of assemble-core's API, along with support for managing template collections, template engines and template rendering support
262 |
263 | **Plugins**
264 |
265 | - [assemble-fs][]: adds support for using [gulp][] plugins and working with the file system
266 | - [assemble-streams][]: adds support for pushing views and view collections into a [vinyl][] stream
267 | - [base-task][]: adds flow control methods
268 |
269 | ## About
270 | ### Related projects
271 | Assemble is built on top of these great projects:
272 | {%= related(verb.related.list) %}
273 |
274 | ### Tests
275 | {%= include("tests") %}
276 |
277 | ### Contributing
278 | {%= include("contributing") %}
279 |
280 | If Assemble doesn't do what you need, [please let us know](../../issues).
281 |
282 | ### Release History
283 | {%= increaseHeadings(increaseHeadings(changelog('changelog.md', {
284 | changelogFooter: true,
285 | stripHeading: true,
286 | repo: repo
287 | }))) %}
288 |
289 | ### Authors
290 |
291 | **Jon Schlinkert**
292 |
293 | * [github/jonschlinkert](https://github.com/jonschlinkert)
294 | * [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
295 |
296 | **Brian Woodward**
297 |
298 | * [github/doowb](https://github.com/doowb)
299 | * [twitter/doowb](http://twitter.com/doowb)
300 |
301 | ### License
302 | {%= copyright() %}
303 | {%= license %}
304 |
305 | ***
306 |
307 | {%= include("footer") %}
308 |
309 | {%= reflinks(verb.reflinks) %}
310 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015-2017, Jon Schlinkert
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | # assemble-core
9 |
10 | [](https://www.npmjs.com/package/assemble-core) [](https://npmjs.org/package/assemble-core) [](https://travis-ci.org/assemble/assemble-core) [](https://gitter.im/assemble/assemble-core)
11 |
12 | Built on top of [base](https://github.com/node-base/base) and [templates](https://github.com/jonschlinkert/templates), assemble-core is used in [assemble](https://github.com/assemble/assemble) to provide the baseline features and API necessary for rendering templates, working with the file system, and running tasks.
13 |
14 | 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.
15 |
16 |
17 | Table of contents
18 | - [What can I do with assemble-core?](#what-can-i-do-with-assemble-core)
19 | - [Install](#install)
20 | - [Install](#install-1)
21 | - [Usage](#usage)
22 | - [Examples](#examples)
23 | - [API](#api)
24 | * [File System API](#file-system-api)
25 | + [.src](#src)
26 | + [.dest](#dest)
27 | + [.copy](#copy)
28 | + [.symlink](#symlink)
29 | * [Task API](#task-api)
30 | + [.task](#task)
31 | + [.build](#build)
32 | + [.watch](#watch)
33 | - [FAQ](#faq)
34 | - [Toolkit suite](#toolkit-suite)
35 | - [About](#about)
36 | * [Related projects](#related-projects)
37 | * [Tests](#tests)
38 | * [Contributing](#contributing)
39 | * [Release History](#release-history)
40 | * [Authors](#authors)
41 | * [License](#license)
42 |
43 | _(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_
44 |
45 |
46 | ## What can I do with assemble-core?
47 |
48 | Create your own:
49 |
50 | * blog engine
51 | * project generator / scaffolder
52 | * e-book development framework
53 | * build system
54 | * landing page generator
55 | * documentation generator
56 | * front-end UI framework
57 | * rapid prototyping framework
58 | * static site generator
59 | * web application
60 |
61 | ## Install
62 |
63 | **NPM**
64 |
65 | ## Install
66 |
67 | Install with [npm](https://www.npmjs.com/):
68 |
69 | ```sh
70 | $ npm install --save assemble-core
71 | ```
72 |
73 | **yarn**
74 |
75 | Install with [yarn](yarnpkg.com):
76 |
77 | ```sh
78 | $ yarn add assemble-core && yarn upgrade
79 | ```
80 |
81 | ## Usage
82 |
83 | ```js
84 | var assemble = require('assemble-core');
85 | var app = assemble();
86 | ```
87 |
88 | ## Examples
89 |
90 | **view collections**
91 |
92 | Create a custom view collection:
93 |
94 | ```js
95 | var app = assemble();
96 | app.create('pages');
97 | ```
98 |
99 | Now you can add pages with `app.page()` or `app.pages()`:
100 |
101 | ```js
102 | app.page('home.hbs', {content: 'this is the home page!'});
103 | ```
104 |
105 | **render**
106 |
107 | Render a view:
108 |
109 | ```js
110 | var app = assemble();
111 |
112 | var view = app.view('foo', {content: 'Hi, my name is <%= name %>'});
113 |
114 | app.render(view, { name: 'Brian' }, function(err, res) {
115 | console.log(res.content);
116 | //=> 'Hi, my name is Brian'
117 | });
118 | ```
119 |
120 | Render a view from a collection:
121 |
122 | ```js
123 | var app = assemble();
124 | app.create('pages');
125 |
126 | app.page('foo', {content: 'Hi, my name is <%= name %>'})
127 | .set('data.name', 'Brian')
128 | .render(function (err, res) {
129 | console.log(res.content);
130 | //=> 'Hi, my name is Brian'
131 | });
132 | ```
133 |
134 | ## API
135 |
136 | ### [Assemble](index.js#L22)
137 |
138 | Create an `assemble` application. This is the main function exported by the assemble module.
139 |
140 | **Params**
141 |
142 | * `options` **{Object}**: Optionally pass default options to use.
143 |
144 | **Example**
145 |
146 | ```js
147 | var assemble = require('assemble');
148 | var app = assemble();
149 | ```
150 |
151 | ***
152 |
153 | ### File System API
154 |
155 | Assemble has the following methods for working with the file system:
156 |
157 | * [src](#src)
158 | * [dest](#dest)
159 | * [copy](#copy)
160 | * [symlink](#symlink)
161 |
162 | Assemble v0.6.0 has full [vinyl-fs](http://github.com/wearefractal/vinyl-fs) support, so any [gulp](http://gulpjs.com) plugin should work with assemble.
163 |
164 | #### .src
165 |
166 | Use one or more glob patterns or filepaths to specify source files.
167 |
168 | **Params**
169 |
170 | * `glob` **{String|Array}**: Glob patterns or file paths to source files.
171 | * `options` **{Object}**: Options or locals to merge into the context and/or pass to `src` plugins
172 |
173 | **Example**
174 |
175 | ```js
176 | app.src('src/*.hbs', {layout: 'default'});
177 | ```
178 |
179 | #### .dest
180 |
181 | Specify the destination to use for processed files.
182 |
183 | **Params**
184 |
185 | * `dest` **{String|Function}**: File path or custom renaming function.
186 | * `options` **{Object}**: Options and locals to pass to `dest` plugins
187 |
188 | **Example**
189 |
190 | ```js
191 | app.dest('dist/');
192 | ```
193 |
194 | #### .copy
195 |
196 | Copy files from A to B, where `A` is any pattern that would be valid in [app.src](#src) and `B` is the destination directory.
197 |
198 | **Params**
199 |
200 | * `patterns` **{String|Array}**: One or more file paths or glob patterns for the source files to copy.
201 | * `dest` **{String|Function}**: Desination directory.
202 | * `returns` **{Stream}**: The stream is returned, so you can continue processing files if necessary.
203 |
204 | **Example**
205 |
206 | ```js
207 | app.copy('assets/**', 'dist/');
208 | ```
209 |
210 | #### .symlink
211 |
212 | Glob patterns or paths for symlinks.
213 |
214 | **Params**
215 |
216 | * `glob` **{String|Array}**
217 |
218 | **Example**
219 |
220 | ```js
221 | app.symlink('src/**');
222 | ```
223 |
224 | ***
225 |
226 | ### Task API
227 |
228 | Assemble has the following methods for running tasks and controlling workflows:
229 |
230 | * [task](#task)
231 | * [build](#build)
232 | * [watch](#watch)
233 |
234 | #### .task
235 |
236 | Define a task. Tasks are functions that are stored on a `tasks` object, allowing them to be called later by the [build](#build) method. (the [CLI](https://github.com/assemble/assemble-cli) calls [build](#build) to run tasks)
237 |
238 | **Params**
239 |
240 | * `name` **{String}**: Task name
241 | * `fn` **{Function}**: function that is called when the task is run.
242 |
243 | **Example**
244 |
245 | ```js
246 | app.task('default', function() {
247 | return app.src('templates/*.hbs')
248 | .pipe(app.dest('dist/'));
249 | });
250 | ```
251 |
252 | #### .build
253 |
254 | Run one or more tasks.
255 |
256 | **Params**
257 |
258 | * `tasks` **{Array|String}**: Task name or array of task names.
259 | * `cb` **{Function}**: callback function that exposes `err`
260 |
261 | **Example**
262 |
263 | ```js
264 | app.build(['foo', 'bar'], function(err) {
265 | if (err) console.error('ERROR:', err);
266 | });
267 | ```
268 |
269 | #### .watch
270 |
271 | Watch files, run one or more tasks when a watched file changes.
272 |
273 | **Params**
274 |
275 | * `glob` **{String|Array}**: Filepaths or glob patterns.
276 | * `tasks` **{Array}**: Task(s) to watch.
277 |
278 | **Example**
279 |
280 | ```js
281 | app.task('watch', function() {
282 | app.watch('docs/*.md', ['docs']);
283 | });
284 | ```
285 |
286 | ## FAQ
287 |
288 | **How does assemble-core differ from [assemble](https://github.com/assemble/assemble)?**
289 |
290 | | **feature** | **assemble-core** | **assemble** | **notes** |
291 | | --- | :---: | :---: | --- |
292 | | front-matter parsing | No | Yes | use [assemble](https://github.com/assemble/assemble) or use [parser-front-matter](https://github.com/jonschlinkert/parser-front-matter) as an `.onLoad` middleware. |
293 | | CLI | No | Yes | Create your own CLI experience, or use [assemble](https://github.com/assemble/assemble) |
294 | | Built-in template collections | No | Yes | Use `.create()` to add collections |
295 | | Built-in template engine | No | Yes | [assemble](https://github.com/assemble/assemble) ships with [engine-handlebars](https://github.com/jonschlinkert/engine-handlebars). Use `.engine()` to register any [consolidate](https://github.com/visionmedia/consolidate.js)-compatible template engine. |
296 |
297 | ## Toolkit suite
298 |
299 | assemble-core is a standalone application that was created using applications and plugins from the [toolkit suite](https://github.com/node-toolkit/getting-started):
300 |
301 | **Building blocks**
302 |
303 | * [base](https://github.com/node-base/base): framework for rapidly creating high quality node.js applications, using plugins like building blocks.
304 | * [templates](https://github.com/jonschlinkert/templates): used to create the foundation of assemble-core's API, along with support for managing template collections, template engines and template rendering support
305 |
306 | **Plugins**
307 |
308 | * [assemble-fs](https://github.com/assemble/assemble-fs): adds support for using [gulp](http://gulpjs.com) plugins and working with the file system
309 | * [assemble-streams](https://github.com/assemble/assemble-streams): adds support for pushing views and view collections into a [vinyl](https://github.com/gulpjs/vinyl) stream
310 | * [base-task](https://github.com/node-base/base-task): adds flow control methods
311 |
312 | ## About
313 |
314 | ### Related projects
315 |
316 | Assemble is built on top of these great projects:
317 |
318 | * [assemble](https://www.npmjs.com/package/assemble): Get the rocks out of your socks! Assemble makes you fast at creating web projects… [more](https://github.com/assemble/assemble) | [homepage](https://github.com/assemble/assemble "Get the rocks out of your socks! Assemble makes you fast at creating web projects. Assemble is used by thousands of projects for rapid prototyping, creating themes, scaffolds, boilerplates, e-books, UI components, API documentation, blogs, building websit")
319 | * [boilerplate](https://www.npmjs.com/package/boilerplate): Tools and conventions for authoring and using declarative configurations for project "boilerplates" that can be… [more](https://github.com/jonschlinkert/boilerplate) | [homepage](https://github.com/jonschlinkert/boilerplate "Tools and conventions for authoring and using declarative configurations for project "boilerplates" that can be consumed by any build system or project scaffolding tool.")
320 | * [composer](https://www.npmjs.com/package/composer): API-first task runner with three methods: task, run and watch. | [homepage](https://github.com/doowb/composer "API-first task runner with three methods: task, run and watch.")
321 | * [generate](https://www.npmjs.com/package/generate): Command line tool and developer framework for scaffolding out new GitHub projects. Generate offers the… [more](https://github.com/generate/generate) | [homepage](https://github.com/generate/generate "Command line tool and developer framework for scaffolding out new GitHub projects. Generate offers the robustness and configurability of Yeoman, the expressiveness and simplicity of Slush, and more powerful flow control and composability than either.")
322 | * [scaffold](https://www.npmjs.com/package/scaffold): Conventions and API for creating declarative configuration objects for project scaffolds - similar in format… [more](https://github.com/jonschlinkert/scaffold) | [homepage](https://github.com/jonschlinkert/scaffold "Conventions and API for creating declarative configuration objects for project scaffolds - similar in format to a grunt task, but more portable, generic and can be used by any build system or generator - even gulp.")
323 | * [templates](https://www.npmjs.com/package/templates): System for creating and managing template collections, and rendering templates with any node.js template engine… [more](https://github.com/jonschlinkert/templates) | [homepage](https://github.com/jonschlinkert/templates "System for creating and managing template collections, and rendering templates with any node.js template engine. Can be used as the basis for creating a static site generator or blog framework.")
324 | * [verb](https://www.npmjs.com/package/verb): Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used… [more](https://github.com/verbose/verb) | [homepage](https://github.com/verbose/verb "Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used on hundreds of projects of all sizes to generate everything from API docs to readmes.")
325 |
326 | ### Tests
327 |
328 | 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:
329 |
330 | ```sh
331 | $ npm install && npm test
332 | ```
333 |
334 | ### Contributing
335 |
336 | Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
337 |
338 | Please read the [contributing guide](.github/contributing.md) for advice on opening issues, pull requests, and coding standards.
339 |
340 | If Assemble doesn't do what you need, [please let us know](../../issues).
341 |
342 | ### Release History
343 |
344 | #### key
345 |
346 | Changelog entries are classified using the following labels from [keep-a-changelog](https://github.com/olivierlacan/keep-a-changelog):
347 |
348 | * `added`: for new features
349 | * `changed`: for changes in existing functionality
350 | * `deprecated`: for once-stable features removed in upcoming releases
351 | * `removed`: for deprecated features removed in this release
352 | * `fixed`: for any bug fixes
353 |
354 | Custom labels used in this changelog:
355 |
356 | * `dependencies`: bumps dependencies
357 | * `housekeeping`: code re-organization, minor edits, or other changes that don't fit in one of the other categories.
358 |
359 | **Heads up!**
360 |
361 | Please [let us know](../../issues) if any of the following heading links are broken. Thanks!
362 |
363 | #### [0.31.0](https://github.com/assemble/assemble-core/compare/0.30.0...0.31.0) - 2017-02-11
364 |
365 | **dependencies**
366 |
367 | * Bumps [assemble-streams](https://github.com/assemble/assemble-streams) to ensure that `view` is decorated with `.toStream()` when created by app (instead of a collection). This is arguably a bugfix, but it might break someone's code.
368 |
369 | #### [0.30.0](https://github.com/assemble/assemble-core/compare/0.29.0...0.30.0) - 2017-08-01
370 |
371 | **dependencies**
372 |
373 | * Bumps [assemble-fs](https://github.com/assemble/assemble-fs) and [assemble-render-file](https://github.com/assemble/assemble-render-file) to get updates that merge the dest path information onto the context so that it can be used to calculate relative paths for navigation, pagination, etc.
374 |
375 | #### [0.29.0](https://github.com/assemble/assemble-core/compare/0.28.0...0.29.0) - 2017-02-01
376 |
377 | **dependencies**
378 |
379 | * Bumps [assemble-fs](https://github.com/assemble/assemble-fs) to v0.9.0 to take advantage of improvements to `.dest()` handling.
380 |
381 | #### [0.28.0](https://github.com/assemble/assemble-core/compare/0.27.0...0.28.0) - 2017-02-01
382 |
383 | **dependencies**
384 |
385 | * Bumps [templates](https://github.com/jonschlinkert/templates) to v1.2.0 to take advantage of new methods available on `list`s
386 |
387 | #### [0.27.0](https://github.com/assemble/assemble-core/compare/0.26.0...0.27.0) - 2016-12-27
388 |
389 | **dependencies**
390 |
391 | * Bumps [templates](https://github.com/jonschlinkert/templates) to v1.0.0 to take advantage of new template inheritance features!
392 | * Bumps [assemble-fs](https://github.com/assemble/assemble-fs) to v0.8.0
393 |
394 | #### [0.26.0](https://github.com/assemble/assemble-core/compare/0.25.0...0.26.0) - 2016-08-06
395 |
396 | **dependencies**
397 |
398 | * Bumps [assemble-fs](https://github.com/assemble/assemble-fs) to v0.7.0 to take advantage of `handle.once`
399 | * Bumps [templates](https://github.com/jonschlinkert/templates) to v0.25.0 to take advantage of async collection loaders. No changes to existing API.
400 |
401 | #### [0.25.0](https://github.com/assemble/assemble-core/compare/0.24.0...0.25.0) - 2016-07-05
402 |
403 | **changed**
404 |
405 | * Minor code organization and [private properties were changed](https://github.com/assemble/assemble-core/commit/5746164004647f2b7dc8883a3323922839f56958). This is technically a housekeeping change since these methods weren't exposed on the API, but it's possible someone was using them in an unintended way.
406 |
407 | #### [0.24.0](https://github.com/assemble/assemble-core/compare/0.23.0...0.24.0)
408 |
409 | **dependencies**
410 |
411 | * Bumps [templates](https://github.com/jonschlinkert/templates) to v0.24.0 to use the latest [base-data](https://github.com/node-base/base-data)
412 |
413 | **removed**
414 |
415 | * The bump in `templates` removes the `renameKey` option from the `.data` method. Use the `namespace` option instead.
416 |
417 | #### [0.23.0](https://github.com/assemble/assemble-core/compare/0.22.0...0.23.0)
418 |
419 | **fixed**
420 |
421 | * Bumps [templates](https://github.com/jonschlinkert/templates) to v0.23.0 to fix bug with double rendering in [engine-cache](https://github.com/jonschlinkert/engine-cache).
422 |
423 | #### [0.22.0](https://github.com/assemble/assemble-core/compare/0.21.0...0.22.0)
424 |
425 | **dependencies**
426 |
427 | * Bumps [templates](https://github.com/jonschlinkert/templates) to v0.22.0 to take advantage of fixes and improvements to lookup methods: `.find` and `getView`. No API changes were made. Please [let us know](../../issues) if regressions occur.
428 | * Bumps [base](https://github.com/node-base/base) to take advantages of code optimizations.
429 |
430 | **fixed**
431 |
432 | * fixes `List` bug that was caused collection helpers to explode
433 |
434 | **changed**
435 |
436 | * Improvements to lookup functions: `app.getView()` and `app.find()`
437 |
438 | #### [0.21.0](https://github.com/assemble/assemble-core/compare/0.20.0...0.21.0)
439 |
440 | **dependencies**
441 |
442 | * Bumps [templates](https://github.com/jonschlinkert/templates) to v0.21.0.
443 |
444 | **removed**
445 |
446 | * Support for the `queue` property was removed on collections. See [templates](https://github.com/jonschlinkert/templates) for additional details.
447 |
448 | #### [0.20.0](https://github.com/assemble/assemble-core/compare/0.19.0...0.20.0)
449 |
450 | **dependencies**
451 |
452 | * Bumps [templates](https://github.com/jonschlinkert/templates) to v0.20.0.
453 |
454 | **changed**
455 |
456 | * Some changes were made to context handling that effected one unit test out of ~1,000. although it's unlikely you'll be effected by the change, it warrants a minor bump
457 |
458 | #### [0.19.0](https://github.com/assemble/assemble-core/compare/0.18.0...0.19.0)
459 |
460 | **dependencies**
461 |
462 | * Bumps [templates](https://github.com/jonschlinkert/templates) to v0.19.0
463 |
464 | **housekeeping**
465 |
466 | * Externalizes tests (temporarily) to base-test-runner, until we get all of the tests streamlined to the same format.
467 |
468 | #### [0.18.0](https://github.com/assemble/assemble-core/compare/0.17.0...0.18.0)
469 |
470 | **dependencies**
471 |
472 | * Bumps [assemble-loader](https://github.com/assemble/assemble-loader) to v0.5.0, which includes which fixes a bug where `renameKey` was not always being used when defined on collection loader options.
473 | * Bumps [templates](https://github.com/jonschlinkert/templates) to v0.18.0, which includes fixes for resolving layouts
474 |
475 | #### [0.17.0](https://github.com/assemble/assemble-core/compare/0.16.0...0.17.0)
476 |
477 | **dependencies**
478 |
479 | * Bumps [templates](https://github.com/jonschlinkert/templates) to v0.17.0
480 |
481 | #### [0.16.0](https://github.com/assemble/assemble-core/compare/0.15.0...0.16.0)
482 |
483 | **dependencies**
484 |
485 | * Bumps [assemble-render-file](https://github.com/assemble/assemble-render-file) to v0.5.0 and [templates](https://github.com/jonschlinkert/templates) to v0.16.0
486 |
487 | #### [0.15.0](https://github.com/assemble/assemble-core/compare/0.14.0...0.15.0)
488 |
489 | **dependencies**
490 |
491 | * Bumps [assemble-streams](https://github.com/assemble/assemble-streams) to v0.5.0
492 |
493 | #### [0.14.0](https://github.com/assemble/assemble-core/compare/0.13.0...0.14.0)
494 |
495 | **dependencies**
496 |
497 | * Bumps [templates](https://github.com/jonschlinkert/templates) to v0.15.1
498 |
499 | **deprecated**
500 |
501 | * `.handleView` method is now deprecated, use `.handleOnce` instead
502 |
503 | **changed**
504 |
505 | * Private method `.mergePartialsSync` rename was reverted to `.mergePartials` to be consistent with other updates in `.render` and `.compile`.
506 |
507 | **added**
508 |
509 | * adds logging methods from [base-logger](https://github.com/node-base/base-logger) (`.log`, `.verbose`, etc)
510 | * No other breaking changes, but some new features were added to [templates](https://github.com/jonschlinkert/templates) for handling context in views and helpers.
511 |
512 | #### [0.13.0](https://github.com/assemble/assemble-core/compare/0.9.0...0.13.0)
513 |
514 | * Breaking change: bumps [templates](https://github.com/jonschlinkert/templates) to v0.13.0 to fix obscure rendering bug when multiple duplicate partials were rendered in the same view. But the fix required changing the `.mergePartials` method to be async. If you're currently using `.mergePartials`, you can continue to do so synchronously using the `.mergePartialsSync` method.
515 |
516 | #### [0.9.0](https://github.com/assemble/assemble-core/compare/0.8.0...0.9.0)
517 |
518 | * Updates [composer](https://github.com/doowb/composer) to v0.11.0, which removes the `.watch` method in favor of using the [base-watch](https://github.com/node-base/base-watch) plugin.
519 |
520 | #### [0.8.0](https://github.com/assemble/assemble-core/compare/0.7.0...0.8.0)
521 |
522 | * Bumps several deps. [templates](https://github.com/jonschlinkert/templates) was bumped to 0.9.0 to take advantage of event handling improvements.
523 |
524 | #### [0.7.0](https://github.com/assemble/assemble-core/compare/0.6.0...0.7.0)
525 |
526 | * Bumps [templates](https://github.com/jonschlinkert/templates) to 0.8.0 to take advantage of `isType` method for checking a collection type, and a number of improvements to how collections and views are instantiated and named.
527 |
528 | #### [0.6.0](https://github.com/assemble/assemble-core/compare/0.5.0...0.6.0)
529 |
530 | * Bumps [assemble-fs](https://github.com/assemble/assemble-fs) plugin to 0.5.0, which introduces `onStream` and `preWrite` middleware handlers.
531 | * Bumps [templates](https://github.com/jonschlinkert/templates) to 0.7.0, which fixes how non-cached collections are initialized. This was done as a minor instead of a patch since - although it's a fix - it could theoretically break someone's setup.
532 |
533 | #### [0.5.0](https://github.com/assemble/assemble-core/compare/0.4.0...0.5.0)
534 |
535 | * Bumps [templates](https://github.com/jonschlinkert/templates) to latest, 0.6.0, since it uses the latest [base-methods](https://github.com/jonschlinkert/base-methods), which introduces prototype mixins. No API changes.
536 |
537 | #### [0.4.0]
538 |
539 | * Removed [emitter-only](https://github.com/doowb/emitter-only) since it was only includes to be used in the default listeners that were removed in an earlier release. In rare cases this might be a breaking change, but not likely.
540 | * Adds lazy-cache
541 | * Updates [assemble-streams](https://github.com/assemble/assemble-streams) plugin to latest
542 |
543 | _(Changelog generated by [helper-changelog](https://github.com/helpers/helper-changelog))_
544 |
545 | ### Authors
546 |
547 | **Jon Schlinkert**
548 |
549 | * [github/jonschlinkert](https://github.com/jonschlinkert)
550 | * [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
551 |
552 | **Brian Woodward**
553 |
554 | * [github/doowb](https://github.com/doowb)
555 | * [twitter/doowb](http://twitter.com/doowb)
556 |
557 | ### License
558 |
559 | Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
560 | MIT
561 |
562 | ***
563 |
564 | _This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.4.2, on February 11, 2017._
--------------------------------------------------------------------------------
/changelog.md:
--------------------------------------------------------------------------------
1 | # Release History
2 |
3 | ## key
4 |
5 | Changelog entries are classified using the following labels from [keep-a-changelog][]:
6 |
7 | * `added`: for new features
8 | * `changed`: for changes in existing functionality
9 | * `deprecated`: for once-stable features removed in upcoming releases
10 | * `removed`: for deprecated features removed in this release
11 | * `fixed`: for any bug fixes
12 |
13 | Custom labels used in this changelog:
14 |
15 | * `dependencies`: bumps dependencies
16 | * `housekeeping`: code re-organization, minor edits, or other changes that don't fit in one of the other categories.
17 |
18 | **Heads up!**
19 |
20 | Please [let us know](../../issues) if any of the following heading links are broken. Thanks!
21 |
22 | ## [0.31.0] - 2017-02-11
23 |
24 | **dependencies**
25 |
26 | - Bumps [assemble-streams][] to ensure that `view` is decorated with `.toStream()` when created by app (instead of a collection). This is arguably a bugfix, but it might break someone's code.
27 |
28 | ## [0.30.0] - 2017-08-01
29 |
30 | **dependencies**
31 |
32 | - Bumps [assemble-fs][] and [assemble-render-file][] to get updates that merge the dest path information onto the context so that it can be used to calculate relative paths for navigation, pagination, etc.
33 |
34 | ## [0.29.0] - 2017-02-01
35 |
36 | **dependencies**
37 |
38 | - Bumps [assemble-fs] to v0.9.0 to take advantage of improvements to `.dest()` handling.
39 |
40 | ## [0.28.0] - 2017-02-01
41 |
42 | **dependencies**
43 |
44 | - Bumps [templates] to v1.2.0 to take advantage of new methods available on `list`s
45 |
46 | ## [0.27.0] - 2016-12-27
47 |
48 | **dependencies**
49 |
50 | - Bumps [templates] to v1.0.0 to take advantage of new template inheritance features!
51 | - Bumps [assemble-fs] to v0.8.0
52 |
53 | ## [0.26.0] - 2016-08-06
54 |
55 | **dependencies**
56 |
57 | - Bumps [assemble-fs][] to v0.7.0 to take advantage of `handle.once`
58 | - Bumps [templates][] to v0.25.0 to take advantage of async collection loaders. No changes to existing API.
59 |
60 | ## [0.25.0] - 2016-07-05
61 |
62 | **changed**
63 |
64 | - Minor code organization and [private properties were changed](https://github.com/assemble/assemble-core/commit/5746164004647f2b7dc8883a3323922839f56958). This is technically a housekeeping change since these methods weren't exposed on the API, but it's possible someone was using them in an unintended way.
65 |
66 | ## [0.24.0]
67 |
68 | **dependencies**
69 |
70 | - Bumps [templates][] to v0.24.0 to use the latest [base-data][]
71 |
72 | **removed**
73 |
74 | - The bump in `templates` removes the `renameKey` option from the `.data` method. Use the `namespace` option instead.
75 |
76 | ## [0.23.0]
77 |
78 | **fixed**
79 |
80 | - Bumps [templates][] to v0.23.0 to fix bug with double rendering in [engine-cache][].
81 |
82 | ## [0.22.0]
83 |
84 | **dependencies**
85 |
86 | - Bumps [templates][] to v0.22.0 to take advantage of fixes and improvements to lookup methods: `.find` and `getView`. No API changes were made. Please [let us know](../../issues) if regressions occur.
87 | - Bumps [base][] to take advantages of code optimizations.
88 |
89 | **fixed**
90 |
91 | - fixes `List` bug that was caused collection helpers to explode
92 |
93 | **changed**
94 |
95 | - Improvements to lookup functions: `app.getView()` and `app.find()`
96 |
97 | ## [0.21.0]
98 |
99 | **dependencies**
100 |
101 | - Bumps [templates][] to v0.21.0.
102 |
103 | **removed**
104 |
105 | - Support for the `queue` property was removed on collections. See [templates][] for additional details.
106 |
107 | ## [0.20.0]
108 |
109 | **dependencies**
110 |
111 | - Bumps [templates][] to v0.20.0.
112 |
113 | **changed**
114 |
115 | - Some changes were made to context handling that effected one unit test out of ~1,000. although it's unlikely you'll be effected by the change, it warrants a minor bump
116 |
117 | ## [0.19.0]
118 |
119 | **dependencies**
120 |
121 | - Bumps [templates][] to v0.19.0
122 |
123 | **housekeeping**
124 |
125 | - Externalizes tests (temporarily) to base-test-runner, until we get all of the tests streamlined to the same format.
126 |
127 | ## [0.18.0]
128 |
129 | **dependencies**
130 |
131 | - Bumps [assemble-loader][] to v0.5.0, which includes which fixes a bug where `renameKey` was not always being used when defined on collection loader options.
132 | - Bumps [templates][] to v0.18.0, which includes fixes for resolving layouts
133 |
134 | ## [0.17.0]
135 |
136 | **dependencies**
137 |
138 | - Bumps [templates][] to v0.17.0
139 |
140 | ## [0.16.0]
141 |
142 | **dependencies**
143 |
144 | - Bumps [assemble-render-file][] to v0.5.0 and [templates][] to v0.16.0
145 |
146 | ## [0.15.0]
147 |
148 | **dependencies**
149 |
150 | - Bumps [assemble-streams][] to v0.5.0
151 |
152 | ## [0.14.0]
153 |
154 | **dependencies**
155 |
156 | - Bumps [templates][] to v0.15.1
157 |
158 | **deprecated**
159 |
160 | - `.handleView` method is now deprecated, use `.handleOnce` instead
161 |
162 | **changed**
163 |
164 | - Private method `.mergePartialsSync` rename was reverted to `.mergePartials` to be consistent with other updates in `.render` and `.compile`.
165 |
166 | **added**
167 |
168 | - adds logging methods from [base-logger][] (`.log`, `.verbose`, etc)
169 | - No other breaking changes, but some new features were added to [templates][] for handling context in views and helpers.
170 |
171 | ## [0.13.0]
172 |
173 | - Breaking change: bumps [templates][] to v0.13.0 to fix obscure rendering bug when multiple duplicate partials were rendered in the same view. But the fix required changing the `.mergePartials` method to be async. If you're currently using `.mergePartials`, you can continue to do so synchronously using the `.mergePartialsSync` method.
174 |
175 | ## [0.9.0]
176 |
177 | - Updates [composer][] to v0.11.0, which removes the `.watch` method in favor of using the [base-watch][] plugin.
178 |
179 | ## [0.8.0]
180 |
181 | - Bumps several deps. [templates][] was bumped to 0.9.0 to take advantage of event handling improvements.
182 |
183 | ## [0.7.0]
184 |
185 | - Bumps [templates][] to 0.8.0 to take advantage of `isType` method for checking a collection type, and a number of improvements to how collections and views are instantiated and named.
186 |
187 | ## [0.6.0]
188 |
189 | - Bumps [assemble-fs][] plugin to 0.5.0, which introduces `onStream` and `preWrite` middleware handlers.
190 | - Bumps [templates][] to 0.7.0, which fixes how non-cached collections are initialized. This was done as a minor instead of a patch since - although it's a fix - it could theoretically break someone's setup.
191 |
192 | ## [0.5.0]
193 |
194 | - Bumps [templates][] to latest, 0.6.0, since it uses the latest [base-methods][], which introduces prototype mixins. No API changes.
195 |
196 | ## [0.4.0]
197 |
198 | - Removed [emitter-only][] since it was only includes to be used in the default listeners that were removed in an earlier release. In rare cases this might be a breaking change, but not likely.
199 | - Adds lazy-cache
200 | - Updates [assemble-streams][] plugin to latest
201 |
202 | [keep-a-changelog]: https://github.com/olivierlacan/keep-a-changelog
203 |
--------------------------------------------------------------------------------
/docs/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/assemble/assemble-core/ed8c3b5a7885ebcb911eb69a3cc8e98f4e27ab01/docs/logo.png
--------------------------------------------------------------------------------
/docs/src/overview.md:
--------------------------------------------------------------------------------
1 | # Overview
2 |
3 | **Features**
4 |
5 | * create custom view collections using `app.create('foo')`
6 | * use any template engine to render views
7 | * support for helpers
8 | * support for partials
9 | * support for layouts
10 | * plugins and middleware
11 |
12 | **Example**
13 |
14 | This is just a small glimpse at the `assemble` API!
15 |
16 | ```js
17 | var assemble = require('assemble');
18 | var app = assemble();
19 |
20 | // create a collection
21 | app.create('pages');
22 |
23 | // add views to the collection
24 | app.page('a.html', {content: 'this is <%= foo %>'});
25 | app.page('b.html', {content: 'this is <%= bar %>'});
26 | app.page('c.html', {content: 'this is <%= baz %>'});
27 |
28 | app.pages.getView('a.html')
29 | .render({foo: 'home'}, function (err, view) {
30 | //=> 'this is home'
31 | });
32 | ```
33 |
34 |
35 |
36 | ## Install
37 |
38 | {%= include("install-npm", {save: true}) %}
39 |
40 | ## Usage
41 |
42 | ```js
43 | var assemble = require('{%= name %}');
44 | var app = assemble();
45 | ```
46 |
47 | ## assemblefile.js
48 |
49 | The following example `assemblefile.js` includes tasks for generating `.html` files from templates and `.css` stylesheets from `.less`.
50 |
51 | ```js
52 | var assemble = require('assemble');
53 | var extname = require('gulp-extname');
54 | var less = require('gulp-less');
55 | var app = assemble();
56 |
57 | app.task('html', function() {
58 | return app.src('templates/*.hbs')
59 | .pipe(extname('.html'))
60 | .pipe(app.dest('dist/'));
61 | });
62 |
63 | app.task('css', function () {
64 | return app.src('styles/*.less')
65 | .pipe(less())
66 | .pipe(app.dest('dist/assets/css'));
67 | });
68 |
69 | app.task('default', ['html', 'css']);
70 | ```
--------------------------------------------------------------------------------
/docs/src/recipes/assemblefile.md:
--------------------------------------------------------------------------------
1 | # example assemblefile.js
2 |
3 | The following basic `assemblefile.js` includes tasks for generating:
4 |
5 | * `.html` files from `.hbs` ([handlebars](http://www.handlebarsjs.com/)) templates
6 | * `.css` stylesheets from `.less` ([less](http://lesscss.org))
7 |
8 | ```js
9 | var assemble = require('assemble');
10 | var extname = require('gulp-extname');
11 | var less = require('gulp-less');
12 | var app = assemble();
13 |
14 | app.task('html', function() {
15 | return app.src('templates/*.hbs')
16 | .pipe(app.renderFile())
17 | .pipe(extname('.html'))
18 | .pipe(app.dest('dist/'));
19 | });
20 |
21 | app.task('css', function () {
22 | return app.src('styles/*.less')
23 | .pipe(less())
24 | .pipe(app.dest('dist/assets/css'));
25 | });
26 |
27 | app.task('default', ['html', 'css']);
28 | ```
29 |
--------------------------------------------------------------------------------
/gulpfile.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | var gulp = require('gulp');
4 | var mocha = require('gulp-mocha');
5 | var istanbul = require('gulp-istanbul');
6 | var eslint = require('gulp-eslint');
7 |
8 | gulp.task('coverage', function() {
9 | return gulp.src(['index.js'])
10 | .pipe(istanbul())
11 | .pipe(istanbul.hookRequire());
12 | });
13 |
14 | gulp.task('test', ['coverage'], function() {
15 | return gulp.src('test/*.js')
16 | .pipe(mocha({reporter: 'spec'}))
17 | .pipe(istanbul.writeReports());
18 | });
19 |
20 | gulp.task('lint', function() {
21 | return gulp.src(['*.js', 'test/*.js'])
22 | .pipe(eslint())
23 | .pipe(eslint.format());
24 | });
25 |
26 | gulp.task('default', ['test', 'lint']);
27 |
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | /**
4 | * module dependencies
5 | */
6 |
7 | var Templates = require('templates');
8 | var utils = require('./utils');
9 |
10 | /**
11 | * Create an `assemble` application. This is the main function exported
12 | * by the assemble module.
13 | *
14 | * ```js
15 | * var assemble = require('assemble');
16 | * var app = assemble();
17 | * ```
18 | * @param {Object} `options` Optionally pass default options to use.
19 | * @api public
20 | */
21 |
22 | function Assemble(options) {
23 | if (!(this instanceof Assemble)) {
24 | return new Assemble(options);
25 | }
26 | Templates.call(this, options);
27 | this.is('assemble');
28 | this.initCore();
29 | }
30 |
31 | /**
32 | * Inherit `Templates`
33 | */
34 |
35 | Templates.extend(Assemble);
36 | Templates.bubble(Assemble);
37 |
38 | /**
39 | * Load core plugins
40 | */
41 |
42 | Assemble.prototype.initCore = function() {
43 | Assemble.initCore(this);
44 | };
45 |
46 | /**
47 | * Load core plugins
48 | */
49 |
50 | Assemble.initCore = function(app) {
51 | Assemble.emit('preInit', app);
52 | Assemble.initPlugins(app);
53 | Assemble.emit('init', app);
54 | };
55 |
56 | /**
57 | * Load core plugins
58 | */
59 |
60 | Assemble.initPlugins = function(app) {
61 | app.use(utils.tasks(app.name));
62 | app.use(utils.streams());
63 | app.use(utils.render());
64 | app.use(utils.fs());
65 | };
66 |
67 | /**
68 | * Expose the `Assemble` constructor
69 | */
70 |
71 | module.exports = Assemble;
72 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "assemble-core",
3 | "description": "The core assemble application with no presets or defaults. All configuration is left to the implementor.",
4 | "version": "0.31.0",
5 | "homepage": "https://github.com/assemble/assemble-core",
6 | "author": "Jon Schlinkert (https://github.com/jonschlinkert)",
7 | "maintainers": [
8 | "Brian Woodward (https://github.com/doowb)",
9 | "Jon Schlinkert (https://github.com/jonschlinkert)"
10 | ],
11 | "repository": "assemble/assemble-core",
12 | "bugs": {
13 | "url": "https://github.com/assemble/assemble-core/issues"
14 | },
15 | "license": "MIT",
16 | "files": [
17 | "index.js",
18 | "utils.js"
19 | ],
20 | "main": "index.js",
21 | "engines": {
22 | "node": ">=4.0"
23 | },
24 | "scripts": {
25 | "test": "mocha"
26 | },
27 | "dependencies": {
28 | "assemble-fs": "^1.0.0",
29 | "assemble-render-file": "^1.0.0",
30 | "assemble-streams": "^1.0.0",
31 | "base-task": "^0.7.0",
32 | "define-property": "^0.2.5",
33 | "lazy-cache": "^2.0.2",
34 | "templates": "^1.2.6"
35 | },
36 | "devDependencies": {
37 | "base-test-runner": "^0.2.0",
38 | "base-test-suite": "^0.4.2",
39 | "gulp": "^3.9.1",
40 | "gulp-eslint": "^3.0.1",
41 | "gulp-format-md": "^0.1.11",
42 | "gulp-istanbul": "^1.1.1",
43 | "gulp-mocha": "^3.0.1",
44 | "helper-changelog": "^0.3.0"
45 | },
46 | "keywords": [
47 | "assemble",
48 | "assembleplugin",
49 | "base",
50 | "blog",
51 | "boilerplate",
52 | "boilerplates",
53 | "bootstrap",
54 | "build",
55 | "builder",
56 | "cli",
57 | "cli-app",
58 | "collection",
59 | "command-line",
60 | "compile",
61 | "component",
62 | "components",
63 | "core",
64 | "create",
65 | "dev",
66 | "development",
67 | "doc",
68 | "docs",
69 | "documentation",
70 | "engines",
71 | "framework",
72 | "front",
73 | "front-matter",
74 | "frontend",
75 | "generate",
76 | "generator",
77 | "handlebars",
78 | "helpers",
79 | "html",
80 | "inflections",
81 | "init",
82 | "jekyll",
83 | "layout",
84 | "markdown",
85 | "pages",
86 | "partial",
87 | "partials",
88 | "plugin",
89 | "post",
90 | "project",
91 | "project-template",
92 | "projects",
93 | "render",
94 | "scaffold",
95 | "scaffolder",
96 | "scaffolding",
97 | "scaffolds",
98 | "site",
99 | "static",
100 | "static-site",
101 | "template",
102 | "templates",
103 | "templating",
104 | "view",
105 | "views",
106 | "web",
107 | "webapp",
108 | "website",
109 | "yaml",
110 | "yeoman",
111 | "yo"
112 | ],
113 | "verb": {
114 | "toc": true,
115 | "layout": false,
116 | "tasks": [
117 | "readme"
118 | ],
119 | "helpers": [
120 | "helper-changelog"
121 | ],
122 | "plugins": [
123 | "gulp-format-md"
124 | ],
125 | "related": {
126 | "list": [
127 | "assemble",
128 | "boilerplate",
129 | "composer",
130 | "generate",
131 | "scaffold",
132 | "templates",
133 | "verb"
134 | ]
135 | },
136 | "lint": {
137 | "reflinks": true
138 | },
139 | "reflinks": [
140 | "assemble",
141 | "assemble-cli",
142 | "assemble-fs",
143 | "assemble-loader",
144 | "assemble-render-file",
145 | "assemble-streams",
146 | "base",
147 | "base-data",
148 | "base-logger",
149 | "base-methods",
150 | "base-task",
151 | "base-watch",
152 | "composer",
153 | "consolidate",
154 | "emitter-only",
155 | "engine-cache",
156 | "engine-handlebars",
157 | "gulp",
158 | "helper-changelog",
159 | "parser-front-matter",
160 | "templates",
161 | "vinyl",
162 | "vinyl-fs"
163 | ]
164 | },
165 | "lintDeps": {
166 | "ignore": [
167 | "docs",
168 | "examples"
169 | ]
170 | }
171 | }
172 |
--------------------------------------------------------------------------------
/test/_suite.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | var runner = require('base-test-runner')();
4 | var suite = require('base-test-suite');
5 |
6 | /**
7 | * Run the tests in `base-test-suite`
8 | */
9 |
10 | runner.on('assemble', function(file) {
11 | require(file.path)(require('..'));
12 | });
13 |
14 | runner.addFiles('assemble', suite.test.templates);
15 | runner.addFiles('assemble', suite.test['assemble-core']);
16 |
--------------------------------------------------------------------------------
/utils.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | /**
4 | * Module dependencies
5 | */
6 |
7 | var utils = require('lazy-cache')(require);
8 | var fn = require;
9 | require = utils;
10 |
11 | /**
12 | * Lazily required module dependencies
13 | */
14 |
15 | require('assemble-fs', 'fs');
16 | require('assemble-render-file', 'render');
17 | require('assemble-streams', 'streams');
18 | require('base-task', 'tasks');
19 | require('define-property', 'define');
20 | require = fn;
21 |
22 | /**
23 | * Expose `utils` modules
24 | */
25 |
26 | module.exports = utils;
27 |
--------------------------------------------------------------------------------