The following will minify your assets with grunt each time a generation write completes.
- Install Dependencies
# ================================= | |
# DocPad Events | |
# Here we can define handlers for events that DocPad fires | |
# You can find a full listing of events on the DocPad Wiki | |
events: | |
# Server Extend | |
# Used to add our own custom routes to the server before the docpad routes are added | |
serverExtend: (opts) -> |
// Create our server | |
var server; | |
server = http.createServer(function(req,res){ | |
// Set CORS headers | |
res.setHeader('Access-Control-Allow-Origin', '*'); | |
res.setHeader('Access-Control-Request-Method', '*'); | |
res.setHeader('Access-Control-Allow-Methods', 'OPTIONS, GET'); | |
res.setHeader('Access-Control-Allow-Headers', '*'); | |
if ( req.method === 'OPTIONS' ) { | |
res.writeHead(200); |
/* | |
Syntax highlighting with language autodetection. | |
http://softwaremaniacs.org/soft/highlight/ | |
*/ | |
var highlightAfter = function() { | |
/* Utility functions */ | |
function escape(value) { |
The following will minify your assets with grunt each time a generation write completes.
Generates a sitemap.txt
file your website. To use add the contents of the docpad.coffee
file of this gist into your docpad configuration file.
Note: There is now the Sitemap Plugin which generates a proper sitemap.xml
file for you automatically instead of the basic sitemap.txt
file this gist creates.
plugins: | |
marked: | |
markedOptions: | |
sanitize: false |
Running against the Kitchensink Skeleton
In one terminal window run:
git clone git://github.com/docpad/kitchensink.docpad.git docpad-benchmark
cd docpad-benchmark
npm install
Uses a docpad configuration file to specify template data that we can use in our document to generate absolute urls.
// Generated by CoffeeScript 1.4.0 | |
(function() { | |
var Backbone, Criteria, Hash, Pill, Query, QueryCollection, queryEngine, util, _, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, | |
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }, | |
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, | |
__slice = [].slice; | |
_ = typeof module !== "undefined" && module !== null ? require('underscore') : this._; |