File tree 8 files changed +70
-6
lines changed
8 files changed +70
-6
lines changed Original file line number Diff line number Diff line change 5
5
6
6
// For performance use one level down: 'name/{,*/}*.js'
7
7
// If you want to recursively match all subfolders, use: 'name/**/*.js'
8
+
8
9
module.exports = function (grunt) {
9
10
'use strict';
10
11
11
12
var _ = require('underscore'),
12
13
path = require('path'),
13
- themes = require('./dev/tools/grunt/configs/themes' ),
14
+ themes = require('./dev/tools/grunt/tools/files-router').getThemes( ),
14
15
configDir = './dev/tools/grunt/configs',
15
16
tasks = grunt.file.expand('./dev/tools/grunt/tasks/*');
16
17
Original file line number Diff line number Diff line change 5
5
6
6
'use strict' ;
7
7
8
- var themes = require ( './themes' ) ,
8
+ var themes = require ( '../tools/files-router' ) . getThemes ( ) ,
9
9
_ = require ( 'underscore' ) ;
10
10
11
11
var themeOptions = { } ;
Original file line number Diff line number Diff line change 5
5
6
6
'use strict' ;
7
7
8
- var theme = require ( './themes' ) ,
8
+ var theme = require ( '../tools/files-router' ) . getThemes ( ) ,
9
9
path = require ( './path' ) ;
10
10
11
11
/**
Original file line number Diff line number Diff line change 6
6
'use strict' ;
7
7
8
8
var combo = require ( './combo' ) ,
9
- themes = require ( './themes' ) ,
9
+ themes = require ( '../tools/files-router' ) . getThemes ( ) ,
10
10
_ = require ( 'underscore' ) ;
11
11
12
12
var themeOptions = { } ;
Original file line number Diff line number Diff line change 6
6
'use strict' ;
7
7
8
8
var combo = require ( './combo' ) ,
9
- themes = require ( './themes' ) ,
9
+ themes = require ( '../tools/files-router' ) . getThemes ( ) ,
10
10
_ = require ( 'underscore' ) ;
11
11
12
12
var themeOptions = { } ;
Original file line number Diff line number Diff line change 6
6
'use strict' ;
7
7
8
8
var combo = require ( './combo' ) ,
9
- themes = require ( './themes' ) ,
9
+ themes = require ( '../tools/files-router' ) . getThemes ( ) ,
10
10
_ = require ( 'underscore' ) ;
11
11
12
12
var themeOptions = { } ;
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Copyright © 2016 Magento. All rights reserved.
3
+ * See COPYING.txt for license details.
4
+ */
5
+
6
+ 'use strict' ;
7
+
8
+ module . exports = {
9
+ defaultConfig : {
10
+ 'themes' : 'dev/tools/grunt/configs/themes'
11
+ } ,
12
+
13
+ /**
14
+ * Immediately invoked function.
15
+ * Loads user config file.
16
+ */
17
+ userConfig : ( function ( ) {
18
+ try {
19
+ return require ( process . cwd ( ) + '/grunt-config' ) ;
20
+ } catch ( error ) {
21
+ return null ;
22
+ }
23
+ } ) ( ) ,
24
+
25
+ /**
26
+ * Loads "themes" file.
27
+ * Load priority:
28
+ * From user config;
29
+ * From default config with ".loc" suffix ;
30
+ * From default config;
31
+ *
32
+ * @returns themes file or error
33
+ */
34
+ getThemes : function ( ) {
35
+ if ( this . userConfig && this . userConfig . themes ) {
36
+ return require ( this . getFullPath ( this . userConfig . themes ) ) ;
37
+ } else {
38
+ try {
39
+ return require ( this . getFullPath ( this . defaultConfig . themes + '.loc' ) ) ;
40
+ } catch ( error ) {
41
+ try {
42
+ return require ( this . getFullPath ( this . defaultConfig . themes ) ) ;
43
+ } catch ( error ) {
44
+ throw error ;
45
+ }
46
+ }
47
+ }
48
+ } ,
49
+
50
+ /**
51
+ * Generates full path to file.
52
+ *
53
+ * @param {String } path - relative path to file.
54
+ *
55
+ * @returns {String } Full path to file
56
+ */
57
+ getFullPath : function ( path ) {
58
+ return process . cwd ( ) + '/' + path ;
59
+ }
60
+ } ;
Original file line number Diff line number Diff line change
1
+ {
2
+ "themes": "dev/tools/grunt/configs/local-themes"
3
+ }
You can’t perform that action at this time.
0 commit comments