File tree Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change 1
- var THEMED = '@import "~react-toolbox/_colors"; \n $theme-building: true;' ;
1
+ var HEADING = '@import "~react-toolbox/lib /_colors"; \n $theme-building: true;' ;
2
2
var DEFAULT_NAME = 'theme.scss' ;
3
3
var path = require ( 'path' ) ;
4
4
var fs = require ( 'fs' ) ;
5
5
6
6
module . exports = function ( source ) {
7
7
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 ;
10
12
var themePath = path . resolve ( themeName ) ;
13
+ var heading = HEADING ;
14
+
15
+ if ( ! fromBuild ) {
16
+ heading = heading . replace ( '/lib' , '' ) ;
17
+ }
11
18
12
19
this . addDependency ( themePath ) ;
13
20
14
21
fs . readFile ( themePath , "utf-8" , function ( err , theme ) {
15
22
if ( err ) return callback ( err ) ;
16
- callback ( null , THEMED + '\n' + theme + '\n' + source ) ;
23
+ callback ( null , heading + '\n' + theme + '\n' + source ) ;
17
24
} ) ;
18
25
} ;
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " toolbox-loader" ,
3
- "version" : " 0.0.2 " ,
3
+ "version" : " 0.0.3 " ,
4
4
"description" : " A loader used to add SASS themes for React Toolbox" ,
5
5
"main" : " index.js" ,
6
6
"scripts" : {
You can’t perform that action at this time.
0 commit comments