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
crequire: [{
string: 'require("highlight.js")',
path: 'highlight.js',
index: 7,
flag: null
}]
crequire: [{
string: 'require("a")',
path: 'a',
index: 0,
var repeat = require('repeat-string');
var longest = require('longest');
var wrap = require('word-wrap');
var str = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis';
var end = repeat('*', 54);
{ options:
{ 'default routes': false,
'default engines': false,
'default helpers': true,
'router methods': [],
'view engine': '*',
debugEngine: false,
defaultLayout: null,
layoutDelims: [ '{%', '%}' ],
layoutTag: 'body',
@jonschlinkert
jonschlinkert / plugin.js
Last active August 29, 2015 14:20
Suggested (internal) plugin signature for template-based applications.
var through = require('through2');
var PluginError = require('plugin-error');
var extend = require('extend-shallow');
module.exports = function (appname, name, config) {
var plugin = appname + '-' + name;
return function init(options) {
options = extend({}, config, options);
function braces(str, open, close) {
var braceCount = 0;
var ch;
var pos = -1;
var len = str.length;
var res = {node: {}};
var num = 0, prev, nseg = 0;
var brace = false;
while (++pos < len) {
function foo() {
}
function bar() {
}
function baz(provider) {
var name = ' ' + provider.name || '';
var fn = bar.bind(provider);
fn.inspect = function () {
return '[function' + name + ']';
};
'use strict';
var path = require('path');
var glob = require('globby');
var App = require('template');
var app = new App();
app.paths = {};
app.mixin('setPath', function (dest, collection, key) {
var app = {options: {}};
var file = {};
function createGetter(file) {
var args = [].slice.call(arguments, 1);
var len = args.length, i = -1;
return function (prop) {
var cache = {};
var Base = require('base-methods');
function App() {
Base.call(this);
this.define('loaded', false);
this.cache = {};
}
Base.extend(App);
App.prototype.use = function(fn) {
function App() {
this.views = {};
this.plugins = [];
}
App.prototype.use = function (fn) {
var plugin = fn(this);
if (typeof plugin === 'function') {
this.plugins.push(plugin.bind(this));
}