Skip to content

Commit

Permalink
Add basic support for require
Browse files Browse the repository at this point in the history
  • Loading branch information
taylortom committed Oct 16, 2017
1 parent 010ff29 commit e1e6810
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
18 changes: 18 additions & 0 deletions js/exports.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
var fs = require('fs');

var exports = {};

['build','serve'].forEach(function(name) {
exports[name] = function(args, cb) {
if(typeof args === 'function') {
cb = args;
args = {};
}
if(args.dir && fs.existsSync(args.dir)) {
process.env.SITE_SRC = args.dir;
}
require(`../bin/${name}`)(args, cb);
}
});

module.exports = exports;
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"bin": {
"ss": "index.js"
},
"main": "js/exports.js",
"siteSrc": "/Users/tom/Projects/tomtaylor.name/main",
"templateDefaults": {
"container": "page.html",
Expand Down

0 comments on commit e1e6810

Please sign in to comment.