Skip to content

Instantly share code, notes, and snippets.

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 Aug 29, 2015
Everything you need to build a complete project with Assemble v0.6.0
View assemblefile.js
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'))
});
View Assemble-Gruntfile.js
module.exports = function(grunt) {
'use strict';
grunt.initConfig({
assemble: {
options: {
partials: ['<%= app.templates %>/includes/*.hbs'],
},
site: {
View default.hbs
<!-- 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 Aug 29, 2015
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.)
View verbfile-with-logging.js
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 Mar 21, 2014
Runtime config file for Verb.
View .verbrc.yml
# ===============================================
# Verb config > https://github.com/assemble/verb
# ===============================================
username: jonschlinkert
data: docs/repos.json
View filter-paths.js
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 Aug 29, 2015
WIP, I'll add to this conversion guide as I think of things.
View grunt-readme-to-verb-conversion.md

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 Aug 29, 2015
Create a theme with Assemble
View .assemblerc.yml
# 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
View tutorial-create-permalinks-using-stringsjs.md
View fixtures.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('~');