|
1 |
| -/* |
2 |
| - * patternlab-node - v2.4.4 - 2016 |
3 |
| - * |
| 1 | +/* |
| 2 | + * patternlab-node - v2.4.4 - 2016 |
| 3 | + * |
4 | 4 | * Brian Muenzenmeyer, Geoff Pursell, and the web community.
|
5 |
| - * Licensed under the MIT license. |
6 |
| - * |
7 |
| - * Many thanks to Brad Frost and Dave Olsen for inspiration, encouragement, and advice. |
| 5 | + * Licensed under the MIT license. |
| 6 | + * |
| 7 | + * Many thanks to Brad Frost and Dave Olsen for inspiration, encouragement, and advice. |
8 | 8 | *
|
9 | 9 | */
|
10 | 10 |
|
@@ -84,12 +84,14 @@ var patternlab_engine = function (config) {
|
84 | 84 | lh = require('./lineage_hunter'),
|
85 | 85 | ui = require('./ui_builder'),
|
86 | 86 | sm = require('./starterkit_manager'),
|
| 87 | + pm = require('./plugin_manager'), |
87 | 88 | patternlab = {};
|
88 | 89 |
|
89 | 90 | patternlab.package = fs.readJSONSync(path.resolve(__dirname, '../../package.json'));
|
90 | 91 | patternlab.config = config || fs.readJSONSync(path.resolve(__dirname, '../../patternlab-config.json'));
|
91 | 92 |
|
92 | 93 | checkConfiguration(patternlab);
|
| 94 | + initializePlugins(patternlab); |
93 | 95 |
|
94 | 96 | var paths = patternlab.config.paths;
|
95 | 97 |
|
@@ -170,6 +172,19 @@ var patternlab_engine = function (config) {
|
170 | 172 | }
|
171 | 173 | }
|
172 | 174 |
|
| 175 | + function initializePlugins(patternlab) { |
| 176 | + var plugin_manager = new pm(patternlab.config, path.resolve(__dirname, '../../patternlab-config.json')); |
| 177 | + var foundPlugins = plugin_manager.detect_plugins(); |
| 178 | + |
| 179 | + if (foundPlugins && foundPlugins.length > 0) { |
| 180 | + |
| 181 | + for (var i = 0; i < foundPlugins.length; i++) { |
| 182 | + var plugin = plugin_manager.load_plugin(foundPlugins[i]); |
| 183 | + plugin(patternlab); |
| 184 | + } |
| 185 | + } |
| 186 | + } |
| 187 | + |
173 | 188 | function setCacheBust() {
|
174 | 189 | if (patternlab.config.cacheBust) {
|
175 | 190 | if (patternlab.config.debug) {
|
|
0 commit comments