From 080e8d15eeaa03522c34eba751bb6d5cd1118170 Mon Sep 17 00:00:00 2001
From: Ken Hawkins <khawkins98@gmail.com>
Date: Mon, 8 Apr 2019 13:38:17 +0200
Subject: [PATCH] fix: make fractal.js more configurable

Allows passin of theme, build, and browser open options.

Will need to move all these options into a proper config setting in a new PR.
---
 fractal.js  | 11 +++++++----
 gulpfile.js |  1 +
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/fractal.js b/fractal.js
index 8821ce705..455fce3bc 100644
--- a/fractal.js
+++ b/fractal.js
@@ -47,7 +47,7 @@ module.exports = {
       //   // global-name: global-val
       // },
       extensions: {
-        codeblock: require('./tools/vf-frctl-extensions/codeblock.js')(fractal)
+        codeblock: require(__dirname + '/tools/vf-frctl-extensions/codeblock.js')(fractal)
       }
     });
 
@@ -65,15 +65,18 @@ module.exports = {
     fractal.web.set('builder.dest', vfBuilderPath);
 
     /* configure web */
-    fractal.web.set('static.path', __dirname + '/public');
+    var vfStaticPath = global.vfStaticPath || __dirname + '/public';
+    fractal.web.set('static.path', vfStaticPath);
     fractal.web.set('server.sync', true);
+    var vfOpenBrowswer = global.vfOpenBrowswer || true;
     fractal.web.set('server.syncOptions', {
-      open: true,
+      open: vfOpenBrowswer,
       browser: 'default',
       sync: true
     });
 
-    const vfTheme = require('./tools/vf-frctl-theme');
+    var vfThemePath = global.vfThemePath || '@frctl/mandelbrot';
+    const vfTheme = require(vfThemePath);
     const vfThemeConfig = vfTheme({}, fractal);
 
     fractal.components.set('statuses', {
diff --git a/gulpfile.js b/gulpfile.js
index 59d828b1e..4e3d53520 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -13,6 +13,7 @@ const config = JSON.parse(fs.readFileSync('./package.json'));
 global.vfName = config.vfConfig.vfName;
 global.vfNamespace = config.vfConfig.vfNamespace;
 global.vfComponentPath = __dirname + '/components';
+global.vfThemePath = './tools/vf-frctl-theme';
 
 // -----------------------------------------------------------------------------
 // Dependencies
-- 
GitLab