mirror of
https://github.com/JuanCanham/HackMyResume.git
synced 2024-11-22 00:10:15 +00:00
feat: allow standalone FRESH themes to inherit
This commit is contained in:
parent
66f3cb15c9
commit
7262578c81
10
dist/core/fresh-theme.js
vendored
10
dist/core/fresh-theme.js
vendored
@ -62,10 +62,14 @@ Definition of the FRESHTheme class.
|
|||||||
if (this.inherits) {
|
if (this.inherits) {
|
||||||
cached = {};
|
cached = {};
|
||||||
_.each(this.inherits, function(th, key) {
|
_.each(this.inherits, function(th, key) {
|
||||||
var d, themePath, themesFolder;
|
var d, themePath, themesObj;
|
||||||
themesFolder = require.resolve('fresh-themes');
|
themesObj = require('fresh-themes');
|
||||||
d = parsePath(themeFolder).dirname;
|
if (_.has(themesObj.themes, th)) {
|
||||||
|
themePath = PATH.join(parsePath(require.resolve('fresh-themes')).dirname, '/themes/', th);
|
||||||
|
} else {
|
||||||
|
d = parsePath(th).dirname;
|
||||||
themePath = PATH.join(d, th);
|
themePath = PATH.join(d, th);
|
||||||
|
}
|
||||||
cached[th] = cached[th] || new FRESHTheme().open(themePath);
|
cached[th] = cached[th] || new FRESHTheme().open(themePath);
|
||||||
return formatsHash[key] = cached[th].getFormat(key);
|
return formatsHash[key] = cached[th].getFormat(key);
|
||||||
});
|
});
|
||||||
|
@ -59,9 +59,23 @@ class FRESHTheme
|
|||||||
if @inherits
|
if @inherits
|
||||||
cached = { }
|
cached = { }
|
||||||
_.each @inherits, (th, key) ->
|
_.each @inherits, (th, key) ->
|
||||||
themesFolder = require.resolve 'fresh-themes'
|
# First, see if this is one of the predefined FRESH themes. There are
|
||||||
d = parsePath( themeFolder ).dirname
|
# only a handful of these, but they may change over time, so we need to
|
||||||
|
# query the official source of truth: the fresh-themes repository, which
|
||||||
|
# mounts the themes conveniently by name to the module object, and which
|
||||||
|
# is embedded locally inside the HackMyResume installation.
|
||||||
|
# TODO: merge this code with
|
||||||
|
themesObj = require 'fresh-themes'
|
||||||
|
if _.has themesObj.themes, th
|
||||||
|
themePath = PATH.join(
|
||||||
|
parsePath( require.resolve('fresh-themes') ).dirname,
|
||||||
|
'/themes/',
|
||||||
|
th
|
||||||
|
)
|
||||||
|
else
|
||||||
|
d = parsePath( th ).dirname
|
||||||
themePath = PATH.join d, th
|
themePath = PATH.join d, th
|
||||||
|
|
||||||
cached[ th ] = cached[th] || new FRESHTheme().open( themePath )
|
cached[ th ] = cached[th] || new FRESHTheme().open( themePath )
|
||||||
formatsHash[ key ] = cached[ th ].getFormat( key )
|
formatsHash[ key ] = cached[ th ].getFormat( key )
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user