| |
| 'use strict'; |
|
|
| var path = require('path'); |
|
|
| |
| |
| |
|
|
| module.exports = function(proto) { |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| proto.usingPreset = |
| proto.preset = function(preset) { |
| if (typeof preset === 'function') { |
| preset(this); |
| } else { |
| try { |
| var modulePath = path.join(this.options.presets, preset); |
| var module = require(modulePath); |
|
|
| if (typeof module.load === 'function') { |
| module.load(this); |
| } else { |
| throw new Error('preset ' + modulePath + ' has no load() function'); |
| } |
| } catch (err) { |
| throw new Error('preset ' + modulePath + ' could not be loaded: ' + err.message); |
| } |
| } |
|
|
| return this; |
| }; |
| }; |
|
|