bajo-template 2.3.1 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/resolve-resource.js +20 -18
- package/package.json +1 -1
- package/wiki/CHANGES.md +8 -0
package/lib/resolve-resource.js
CHANGED
|
@@ -29,38 +29,40 @@ function resolveResource (type, item = '', opts = {}, fallbackHandler) {
|
|
|
29
29
|
const fallbackLang = this.app.bajo.config.intl.fallback
|
|
30
30
|
const exts = uniq([`.${fallbackLang}${ext}`, ext])
|
|
31
31
|
if (opts.lang) exts.unshift(`.${opts.lang}${ext}`)
|
|
32
|
+
let theme
|
|
33
|
+
if (opts.theme && this.app.waibuMpa && opts.req) theme = find(this.app.waibuMpa.themes, { name: opts.theme })
|
|
32
34
|
|
|
33
|
-
const extension = subSubNs ?
|
|
35
|
+
const extension = subSubNs ? `${subSubNs}/` : ''
|
|
34
36
|
let file
|
|
37
|
+
// check main override: domain specific
|
|
38
|
+
if (this.app.waibu && opts.req) {
|
|
39
|
+
const hostname = this.app.waibu.getHostname(opts.req)
|
|
40
|
+
const check = `${this.app.main.dir.pkg}/extend/${this.ns}/${hostname}/${ns}/${extension}${type}`
|
|
41
|
+
file = filecheck.call(this, { dir, base, exts, check })
|
|
42
|
+
}
|
|
35
43
|
// check main override: theme specific
|
|
36
|
-
if (
|
|
37
|
-
const check = `${this.app.main.dir.pkg}/extend/${this.ns}
|
|
44
|
+
if (theme && !file) {
|
|
45
|
+
const check = `${this.app.main.dir.pkg}/extend/${this.ns}/${theme.name}/${ns}/${extension}${type}`
|
|
38
46
|
file = filecheck.call(this, { dir, base, exts, check })
|
|
39
47
|
}
|
|
40
48
|
// check main override: common
|
|
41
49
|
if (!file) {
|
|
42
|
-
const check = `${this.app.main.dir.pkg}/extend/${this.ns}
|
|
50
|
+
const check = `${this.app.main.dir.pkg}/extend/${this.ns}/${ns}/${extension}${type}`
|
|
43
51
|
file = filecheck.call(this, { dir, base, exts, check })
|
|
44
52
|
}
|
|
45
53
|
// check override: theme specific
|
|
46
|
-
if (
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
const check = `${theme.plugin.dir.pkg}/extend/${this.ns}/extend/${opts.theme}/${ns}/${extension}${type}`
|
|
50
|
-
file = filecheck.call(this, { dir, base, exts, check })
|
|
51
|
-
}
|
|
54
|
+
if (theme && !file) {
|
|
55
|
+
const check = `${theme.plugin.dir.pkg}/extend/${this.ns}/${theme.name}/${ns}/${extension}${type}`
|
|
56
|
+
file = filecheck.call(this, { dir, base, exts, check })
|
|
52
57
|
}
|
|
53
58
|
// check override: theme specific (common)
|
|
54
|
-
if (
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
const check = `${theme.plugin.dir.pkg}/extend/${this.ns}/extend/_common/${ns}/${extension}${type}`
|
|
58
|
-
file = filecheck.call(this, { dir, base, exts, check })
|
|
59
|
-
}
|
|
59
|
+
if (theme && !file) {
|
|
60
|
+
const check = `${theme.plugin.dir.pkg}/extend/${this.ns}/_common/${ns}/${extension}${type}`
|
|
61
|
+
file = filecheck.call(this, { dir, base, exts, check })
|
|
60
62
|
}
|
|
61
63
|
// check real: theme specific
|
|
62
|
-
if (
|
|
63
|
-
const check = `${this.app[ns].dir.pkg}/extend/${this.ns}/${
|
|
64
|
+
if (theme && !file) {
|
|
65
|
+
const check = `${this.app[ns].dir.pkg}/extend/${this.ns}/${theme.name}/${extension}${type}`
|
|
64
66
|
file = filecheck.call(this, { dir, base, exts, check })
|
|
65
67
|
}
|
|
66
68
|
// check real: common
|
package/package.json
CHANGED