@plotdb/srcbuild 0.0.40 → 0.0.43
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/README.md +2 -1
- package/dist/ext/bundle.js +8 -2
- package/dist/ext/pug.js +8 -8
- package/dist/view/pug.js +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -86,7 +86,8 @@ Except common options, each builder may support different options:
|
|
|
86
86
|
- an additional function `i18n` will be available during pug compilation.
|
|
87
87
|
- `i18n(text)`: translate `text` based on the `i18n` object provided.
|
|
88
88
|
- `language()`: return current language. ( e.g., `zh-TW` )
|
|
89
|
-
- `intlbase(p)`: return a path to given `p`, based on current i18n setup.
|
|
89
|
+
- `intlbase(p, lng)`: return a path to given `p`, based on current i18n ( or specified `lng` arg ) setup.
|
|
90
|
+
- for example, `intlbase('link', 'kr')` may generate `/intl/kr/link`, based on he base dir config.
|
|
90
91
|
- additionally, a pug filter `i18n` is also available, which can be used like:
|
|
91
92
|
|
|
92
93
|
span:i18n translate this text
|
package/dist/ext/bundle.js
CHANGED
|
@@ -29,9 +29,15 @@ bundlebuild = function(opt){
|
|
|
29
29
|
};
|
|
30
30
|
bundlebuild.prototype = import$(Object.create(base.prototype), {
|
|
31
31
|
prepareConfig: function(){
|
|
32
|
-
var type, name, ref$, list, i$, len$, f, this$ = this;
|
|
32
|
+
var e, type, name, ref$, list, i$, len$, f, this$ = this;
|
|
33
33
|
if (this.configFile && fs.existsSync(this.configFile)) {
|
|
34
|
-
|
|
34
|
+
try {
|
|
35
|
+
this.config = JSON.parse(fs.readFileSync(this.configFile).toString());
|
|
36
|
+
} catch (e$) {
|
|
37
|
+
e = e$;
|
|
38
|
+
(this.log ? this.log : console).error(("bundle failed: parse error of config file " + this.configFile).red);
|
|
39
|
+
this.config = {};
|
|
40
|
+
}
|
|
35
41
|
}
|
|
36
42
|
if (typeof this._relativePath === 'string') {
|
|
37
43
|
for (type in this.config) {
|
package/dist/ext/pug.js
CHANGED
|
@@ -145,21 +145,21 @@ pugbuild.prototype = import$(Object.create(base.prototype), {
|
|
|
145
145
|
ret.i18n.language = function(){
|
|
146
146
|
return this$.i18n.language;
|
|
147
147
|
};
|
|
148
|
-
ret.i18n.intlbase = function(p){
|
|
148
|
+
ret.i18n.intlbase = function(p, lng){
|
|
149
149
|
p == null && (p = "");
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
} else {
|
|
150
|
+
lng == null && (lng = "");
|
|
151
|
+
if (!(lng = lng || this$.i18n.language)) {
|
|
153
152
|
return p;
|
|
154
153
|
}
|
|
154
|
+
return path.join(this$.intlbase, lng, p);
|
|
155
155
|
};
|
|
156
|
-
ret.intlbase = function(p){
|
|
156
|
+
ret.intlbase = function(p, lng){
|
|
157
157
|
p == null && (p = "");
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
} else {
|
|
158
|
+
lng == null && (lng = "");
|
|
159
|
+
if (!(lng = lng || this$.i18n.language)) {
|
|
161
160
|
return p;
|
|
162
161
|
}
|
|
162
|
+
return path.join(this$.intlbase, lng, p);
|
|
163
163
|
};
|
|
164
164
|
(ret.filters || (ret.filters = {})).i18n = function(t, o){
|
|
165
165
|
return this$.i18n.t((t || '').trim());
|
package/dist/view/pug.js
CHANGED