Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/segment-boneyard/metalsmith-only-build
Only build a certain subset of an entire metalsmith site.
https://github.com/segment-boneyard/metalsmith-only-build
Last synced: about 7 hours ago
JSON representation
Only build a certain subset of an entire metalsmith site.
- Host: GitHub
- URL: https://github.com/segment-boneyard/metalsmith-only-build
- Owner: segment-boneyard
- Created: 2015-02-06T21:45:39.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-04-08T23:39:16.000Z (over 9 years ago)
- Last Synced: 2024-05-21T12:10:24.025Z (6 months ago)
- Language: JavaScript
- Size: 164 KB
- Stars: 4
- Watchers: 52
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- Changelog: History.md
Awesome Lists containing this project
README
# metalsmith-only-build
> Build only a specific set of files from metalsmith.
The default behavior of metalsmith is to _always_ rebuild **everything**.
The main purpose of this plugin is to try and streamline builds as much as
possible during development. (particularly for `make` users)Before metalsmith starts writing files, this plugin will delete every
reference from the `files` hash that is not specified to be built. This
causes Metalsmith to skip these files during the last phase of the build.
(this plugin should be **last** in order to prevent unwanted side-effects)Most plugins assume that all files in the build will be available in memory,
so we _cannot_ safely reject files from the build at the outset. However, by
skipping the I/O required to write those files at the end, we can save some
build time, while also allowing `make` to be used properly.This plugin goes to great lengths to _not_ change the default behavior of
Metalsmith unless it is very clear that is the intent of the dev.* `Metalsmith.clean` must be set to `false`
* a `METALSMITH_ONLY` env var must be set (as a space-separated list of
files to _only_ include)## Configuration
```js
var only = require('metalsmith-only-build');// make sure this plugin is **last**
metalsmith.use(only())
``````json
{
"plugins": {
// make sure this plugin is **last**
"metalsmith-only-build": true
}
}
```## Usage
```make
build/%.html: articles/%.html
METALSMITH_ONLY="%<" metalsmith
```