Skip to content

Instantly share code, notes, and snippets.

View jonschlinkert's full-sized avatar
🤔
Trying to stay in the right branch of the wave function.

Jon Schlinkert jonschlinkert

🤔
Trying to stay in the right branch of the wave function.
View GitHub Profile
@jonschlinkert
jonschlinkert / assemblefile.js
Last active August 29, 2015 13:57
Everything you need to build a complete project with Assemble v0.6.0
var assemble = require('assemble');
assemble.partials('templates/partials/*.hbs');
assemble.layouts('templates/layouts/*.hbs');
assemble.task('default', function() {
assemble.src('templates/*.hbs')
.pipe(assemble.dest('_gh_pages'))
});
module.exports = function(grunt) {
'use strict';
grunt.initConfig({
assemble: {
options: {
partials: ['<%= app.templates %>/includes/*.hbs'],
},
site: {
<!-- this is a layout -->
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
{{> body }}
{{> styles }}
@jonschlinkert
jonschlinkert / verbfile-with-logging.js
Last active August 29, 2015 13:57
This verbfile adds some basic logging and changes the dest directory to `book/`. (if you don't use a verbfile, verb-cli will just process templates in the `docs` directory by default.)
var file = require('fs-utils');
module.exports = function(verb) {
verb.log.subhead('building', 'My Book');
// Process templates
file.writeFileSync('book/', verb.read('src/*.tmpl.md', {
data: 'chapters/*.json' // custom metadata for templates
}));
@jonschlinkert
jonschlinkert / .verbrc.yml
Created March 21, 2014 13:25
Runtime config file for Verb.
# ===============================================
# Verb config > https://github.com/assemble/verb
# ===============================================
username: jonschlinkert
data: docs/repos.json
var fs = require('fs');
var path = require('path');
var cleanPath = function(filepath) {
filepath = path.relative(process.cwd(), filepath);
return filepath.replace(/\\/g, '/');
};
function lookupFiles(dir, recursive) {
@jonschlinkert
jonschlinkert / grunt-readme-to-verb-conversion.md
Last active August 29, 2015 14:00
WIP, I'll add to this conversion guide as I think of things.

Tags that needs to be converted

_.doc() changed to docs()

The docs() tag is for including markdown files from the local ./docs directory.

  • old: {%= _.doc("foo.md") %}
  • new: {%= docs("foo") %}

Note that the underscore (_.) is gone and the .md extension is no longer needed.

@jonschlinkert
jonschlinkert / .assemblerc.yml
Last active August 29, 2015 14:01
Create a theme with Assemble
# I'm only using a few fields here to demonstrate how this works
# Site theme
theme: slides
# Assets
# The assets path is based on the theme,
# the other paths can build on the assets path
assets: assets/<%= site.theme %>
images: <%= site.assets %>/images
@jonschlinkert
jonschlinkert / tutorial-create-permalinks-using-stringsjs.md
Last active August 29, 2015 14:01
Creating permalinks with Strings.js
var fs = require('fs');
var path = require('path');
var glob = require('globby');
var _ = require('lodash');
var pattern = 'test/fixtures/remarked_pending/**/*.{md,html}';
var len = 'answer_to_life_the_universe_and_everything'.length;
var delim = new Array(len).join('~');