assemble-permalinks

Assemble plugin for easily creating permalinks (Assemble ^0.6.0)

Usage no npm install needed!

<script type="module">
  import assemblePermalinks from 'https://cdn.skypack.dev/assemble-permalinks';
</script>

README

assemble-permalinks NPM version NPM monthly downloads NPM total downloads Linux Build Status Windows Build Status

Assemble plugin for easily creating permalinks (Assemble ^0.6.0)

Install

Install with npm:

$ npm install --save assemble-permalinks

Install with yarn:

$ yarn add assemble-permalinks

HEADS UPS

  • 0.5.0 has a breaking change. It will no longer immediately run the permalink when used on a view directly.

Usage

var permalinks = require('assemble-permalinks');
var assemble = require('assemble');

var app = assemble();

// register the plugin, optionally passing a
// default permalink pattern to use as an argument
// to the plugin
app.use(permalinks());

Example usage

// create a view collection
app.create('pages');

// add a page
app.page('a/b/c.txt', {content: '...'})
  .permalink(':name.html');

var page = app.pages.getView('a/b/c.txt');
console.log(page.data.permalink);
//=> 'c.html'

Pipeline plugin

var posts = app.create('posts')
  .use(permalink('actual/:name/index.html'));

app.task('site', function() {
  return posts.src('*.js')
    .pipe(posts.permalink())
    .pipe(posts.dest('.'));
});

app.build('site', function(err) {
  if (err) throw err;
  console.log('done!');
});

About

Related projects

  • assemble: Get the rocks out of your socks! Assemble makes you fast at creating web projects… more | homepage
  • templates: System for creating and managing template collections, and rendering templates with any node.js template engine… more | homepage

Contributing

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

Contributors

Commits Contributor
26 doowb
14 jonschlinkert

Building docs

(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)

To generate the readme, run the following command:

$ npm install -g verbose/verb#dev verb-generate-readme && verb

Running 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

Author

Jon Schlinkert

License

Copyright © 2017, Jon Schlinkert. Released under the MIT License.


This file was generated by verb-generate-readme, v0.6.0, on June 17, 2017.