bajo-template 2.4.0 → 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.
@@ -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
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 (opts.theme) {
37
- const check = `${this.app.main.dir.pkg}/extend/${this.ns}/${opts.theme}/${ns}/${type}/`
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}/${ns}/${type}`
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 (opts.theme && !file) {
47
- const theme = find(this.app.waibuMpa.themes, { name: opts.theme })
48
- if (theme) {
49
- const check = `${theme.plugin.dir.pkg}/extend/${this.ns}/${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 (opts.theme && !file) {
55
- const theme = find(this.app.waibuMpa.themes, { name: opts.theme })
56
- if (theme) {
57
- const check = `${theme.plugin.dir.pkg}/extend/${this.ns}/_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 (opts.theme && !file) {
63
- const check = `${this.app[ns].dir.pkg}/extend/${this.ns}/${opts.theme}/${extension}${type}`
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bajo-template",
3
- "version": "2.4.0",
3
+ "version": "2.5.0",
4
4
  "description": "Template Renderer for Bajo Framework",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/wiki/CHANGES.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changes
2
2
 
3
+ ## 2026-02-17
4
+
5
+ - [2.5.0] Add ability to extend template by domain
6
+
3
7
  ## 2026-02-15
4
8
 
5
9
  - [2.4.0] Template folder reposition