-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MAGETWO-55345: Grunt uses actual theme's list
- Loading branch information
1 parent
3ef1e28
commit 5c76ada
Showing
8 changed files
with
70 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/** | ||
* Copyright © 2016 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
module.exports = { | ||
defaultConfig: { | ||
'themes': 'dev/tools/grunt/configs/themes' | ||
}, | ||
|
||
/** | ||
* Immediately invoked function. | ||
* Loads user config file. | ||
*/ | ||
userConfig: (function () { | ||
try { | ||
return require(process.cwd() + '/grunt-config'); | ||
} catch (error) { | ||
return null; | ||
} | ||
})(), | ||
|
||
/** | ||
* Loads "themes" file. | ||
* Load priority: | ||
* From user config; | ||
* From default config with ".loc" suffix ; | ||
* From default config; | ||
* | ||
* @returns themes file or error | ||
*/ | ||
getThemes: function () { | ||
if (this.userConfig && this.userConfig.themes) { | ||
return require(this.getFullPath(this.userConfig.themes)); | ||
} else { | ||
try { | ||
return require(this.getFullPath(this.defaultConfig.themes + '.loc')); | ||
} catch (error) { | ||
try { | ||
return require(this.getFullPath(this.defaultConfig.themes)); | ||
} catch (error) { | ||
throw error; | ||
} | ||
} | ||
} | ||
}, | ||
|
||
/** | ||
* Generates full path to file. | ||
* | ||
* @param {String} path - relative path to file. | ||
* | ||
* @returns {String} Full path to file | ||
*/ | ||
getFullPath: function (path) { | ||
return process.cwd() + '/' + path; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"themes": "dev/tools/grunt/configs/local-themes" | ||
} |