-
-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Hi,
I've been learning assemble all week (previously knowing the grunt version), it really looks like powerful set of tools.
I've just been attempting to get a basic site outline set using the blog example from the main assemble repo. My aim is to use and this and submit a pr of a working example for other beginners.
The possible bug: It looks like pages are not rendering with permalinks when they have been added to a collection using a glob or single filename.
Also; what is the method to define new permanlink variables as :site.base returns a Failed to read error?
Here is my assemblefile that outlines a scenario to demonstrate this:
'use strict';
var path = require('path');
var extname = require('gulp-extname');
var permalinks = require('assemble-permalinks');
var getDest = require('view-get-dest');
var assemble = require('assemble');
var app = assemble();
/**
* Plugins
*/
app.use(getDest());
app.use(permalinks());
app.data({
site: {
base: 'setfromdata'
}
});
/**
* Create views collection for our site pages and blog posts.
* Posts will be written in markdown.
*/
app.create('pages');
app.create('posts', {
pager: true,
renameKey: function(key, view) {
return view ? view.basename : path.basename(key);
}
});
// add a page
/**
* Register a handlebars helper for processing markdown.
* This could also be done with a gulp plugin, or a
* middleware, but helpers are really easy and provide
* the most control.
*/
app.helper('markdown', require('helper-markdown'));
app.helper('link-to', require('helper-link-to'));
//app.helper('helper-not', require('assemble-helper-not'));
app.helper('log', function(val) {
console.log(val);
});
/**
* Tasks for loading and rendering our templates
*/
app.task('load', function(cb) {
console.log('hello from load');
app.page('thisis.md', {content: '...'}); // permalinks - works
app.page('home.md', {content: '...'}); // permalinks - works
app.page('src/templates/pages/blog.hbs'); // permalinks - not working
app.partials('src/templates/includes/*.hbs'); // permalinks - not working
app.layouts('src/templates/layouts/*.hbs'); // permalinks - not working
app.pages('src/templates/pages/*.hbs'); // permalinks - not working
app.posts('src/content/*.md'); // permalinks - working ** but rendering outside the dest folder **
cb();
});
/**
* Default task
*/
app.task('default', ['load'], function() {
return app.toStream('pages')
.pipe(app.toStream('posts'))
.on('error', console.log)
.pipe(app.renderFile('md'))
.on('error', console.log)
.pipe(extname())
.pipe(app.permalink(app.data('site.base') + '/site/:name.html'))
//.pipe(app.permalink(app.data(':site.base/site/:name.html'))) // Failed to read: :site.base/site/:name.html
.pipe(app.dest('dest-example'));
/*
.pipe(app.dest(function(file) {
file.path = file.data.permalink;
file.base = path.dirname(file.path);
return file.base;
}));*/
});
/**
* Expose your instance of assemble to the CLI
*/
module.exports = app;
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels