@zbryikt/template 2.3.33 → 2.3.36
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 +1 -0
- package/bin/lib/server.js +7 -7
- package/package.json +2 -2
package/README.md
CHANGED
@@ -79,6 +79,7 @@ server.init accepts config with following options:
|
|
79
79
|
- `startTime` - optional time for providing initialization elapsed time information.
|
80
80
|
- `api` - functions for customizing server. executed before server started
|
81
81
|
- `open` - true to open browser page when server starts. default false
|
82
|
+
- `feroot` - frontend root for serving static file and building view files. default `.`.
|
82
83
|
- `i18n` - i18n options including:
|
83
84
|
- `enabled` - true if i18n is enabled. default `true`.
|
84
85
|
- `lng` - list of locales. default `['zh-tw']`. mapped to folders under `locales/` directory.
|
package/bin/lib/server.js
CHANGED
@@ -16,7 +16,7 @@ server = {
|
|
16
16
|
return i18n(opt.i18n).then(function(i18n){
|
17
17
|
var app, cwd;
|
18
18
|
this$.app = app = express();
|
19
|
-
cwd =
|
19
|
+
cwd = path.resolve(opt.feroot || '.');
|
20
20
|
if (i18n) {
|
21
21
|
app.use(i18nextHttpMiddleware.handle(i18n, {
|
22
22
|
ignoreRoutes: []
|
@@ -25,18 +25,18 @@ server = {
|
|
25
25
|
app.engine('pug', pug({
|
26
26
|
logger: this$.log,
|
27
27
|
i18n: i18n,
|
28
|
-
viewdir: '.view',
|
29
|
-
srcdir: 'src/pug',
|
30
|
-
desdir: 'static'
|
28
|
+
viewdir: path.join(cwd, '.view'),
|
29
|
+
srcdir: path.join(cwd, 'src/pug'),
|
30
|
+
desdir: path.join(cwd, 'static')
|
31
31
|
}));
|
32
32
|
app.set('view engine', 'pug');
|
33
|
-
app.set('views', path.join(cwd, '
|
34
|
-
app.locals.viewdir = path.join(cwd, '
|
33
|
+
app.set('views', path.join(cwd, 'src/pug/'));
|
34
|
+
app.locals.viewdir = path.join(cwd, '.view/');
|
35
35
|
app.locals.basedir = app.get('views');
|
36
36
|
if (opt.api) {
|
37
37
|
opt.api(this$);
|
38
38
|
}
|
39
|
-
app.use('/', express['static']('static'));
|
39
|
+
app.use('/', express['static'](path.join(cwd, 'static')));
|
40
40
|
this$.log.info(("express initialized in " + app.get('env') + " mode").green);
|
41
41
|
return new Promise(function(res, rej){
|
42
42
|
var server;
|
package/package.json
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
"license": "MIT",
|
5
5
|
"main": "bin/lib/index.js",
|
6
6
|
"description": "simple, quick template for bootstrap a page",
|
7
|
-
"version": "2.3.
|
7
|
+
"version": "2.3.36",
|
8
8
|
"files": [
|
9
9
|
"bin/**/*"
|
10
10
|
],
|
@@ -21,7 +21,7 @@
|
|
21
21
|
"start": "./bin/cli.js -o true"
|
22
22
|
},
|
23
23
|
"dependencies": {
|
24
|
-
"@plotdb/srcbuild": "^0.0.
|
24
|
+
"@plotdb/srcbuild": "^0.0.45",
|
25
25
|
"@plotdb/colors": "^0.0.1",
|
26
26
|
"chokidar": "^3.0.0",
|
27
27
|
"express": "^4.16.4",
|