1 | module.exports.getEntryFile = function () {
|
2 | let pages = [];
|
3 |
|
4 | let utils = light.util, path = require('path');
|
5 | let files = utils.glob.sync(`${light.config.src}/*.html`, {
|
6 | nodir: true,
|
7 | matchBase: true
|
8 | })
|
9 |
|
10 | files.forEach(function (file) {
|
11 | let suffix = path.extname(file);
|
12 |
|
13 | let fileId = path.basename(file, suffix);
|
14 | pages.push(fileId)
|
15 | })
|
16 |
|
17 | let fs = require('fs');
|
18 | if (light.options.page && fs.existsSync(`${light.config.src}/${light.options.page}.html`)) {
|
19 | pages = [light.options.page]
|
20 | }
|
21 |
|
22 | let mainPage = pages.length == 1 && pages[0] == 'index' && light.options.page != 'index' ? 'app' : 'index';
|
23 |
|
24 | return {
|
25 | pages: pages,
|
26 | mainPage: mainPage
|
27 | }
|
28 | }
|
29 |
|