Skip to content

Commit 3106a1a

Browse files
committed
Proper load path for colors sass file
1 parent 2d33dcf commit 3106a1a

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

index.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
1-
var THEMED = '@import "~react-toolbox/_colors"; \n $theme-building: true;';
1+
var HEADING = '@import "~react-toolbox/lib/_colors"; \n $theme-building: true;';
22
var DEFAULT_NAME = 'theme.scss';
33
var path = require('path');
44
var fs = require('fs');
55

66
module.exports = function (source) {
77
if (this.cacheable) this.cacheable();
8-
var callback = this.async();
9-
var themeName = this.options.toolboxTheme || DEFAULT_NAME;
8+
var callback = this.async();
9+
var options = this.options.toolbox || {};
10+
var fromBuild = options.fromBuild || true;
11+
var themeName = options.theme || DEFAULT_NAME;
1012
var themePath = path.resolve(themeName);
13+
var heading = HEADING;
14+
15+
if (!fromBuild) {
16+
heading = heading.replace('/lib', '');
17+
}
1118

1219
this.addDependency(themePath);
1320

1421
fs.readFile(themePath, "utf-8", function(err, theme) {
1522
if(err) return callback(err);
16-
callback(null, THEMED + '\n' + theme + '\n' + source);
23+
callback(null, heading + '\n' + theme + '\n' + source);
1724
});
1825
};

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "toolbox-loader",
3-
"version": "0.0.2",
3+
"version": "0.0.3",
44
"description": "A loader used to add SASS themes for React Toolbox",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)