1 | 'use strict';
|
2 |
|
3 | const path = require('path');
|
4 | const extend = require('extend');
|
5 | const basePath = `${path.normalize(process.cwd())}/`;
|
6 |
|
7 | const defaultConfig = {
|
8 | nitro: {
|
9 | basePath,
|
10 | viewFileExtension: 'hbs',
|
11 | viewDirectory: 'src/views',
|
12 | viewPartialsDirectory: 'src/views/_partials',
|
13 | viewDataDirectory: 'src/views/_data',
|
14 | viewLayoutsDirectory: 'src/views/_layouts',
|
15 | placeholdersDirectory: 'src/views/_placeholders',
|
16 | defaultLayout: 'default',
|
17 | view404: '404',
|
18 | tmpDirectory: 'project/tmp',
|
19 | templateEngine: 'hbs',
|
20 | mode: {
|
21 | livereload: true,
|
22 | offline: false,
|
23 | },
|
24 | watch: {
|
25 | partials: true,
|
26 | throttle: {
|
27 | base: 1000,
|
28 | cache: 3000,
|
29 | },
|
30 | },
|
31 |
|
32 | },
|
33 | code: {
|
34 | validation: {
|
35 | eslint: {
|
36 | live: true,
|
37 | },
|
38 | htmllint: {
|
39 | live: true,
|
40 | },
|
41 | jsonSchema: {
|
42 | live: true,
|
43 | },
|
44 | stylelint: {
|
45 | live: true,
|
46 | },
|
47 | },
|
48 | },
|
49 | server: {
|
50 | port: 8080,
|
51 | proxy: {
|
52 | port: 8081,
|
53 | https: false,
|
54 | },
|
55 | production: !!(process.env.NODE_ENV && process.env.NODE_ENV.replace((/\s/g), '') === 'production'),
|
56 | compression: true,
|
57 | },
|
58 | gulp: {
|
59 | dumpViews: {
|
60 | |
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 | },
|
69 | copyAssets: [
|
70 | |
71 |
|
72 |
|
73 |
|
74 | {
|
75 | src: '',
|
76 | dest: '',
|
77 | }
|
78 | ],
|
79 | minifyImages: [
|
80 | |
81 |
|
82 |
|
83 |
|
84 | {
|
85 | src: '',
|
86 | dest: '',
|
87 | },
|
88 | ],
|
89 | svgSprites: [
|
90 | |
91 |
|
92 |
|
93 |
|
94 | {
|
95 | src: '',
|
96 | dest: '',
|
97 | },
|
98 | ],
|
99 | },
|
100 | feature: {
|
101 | i18next: {
|
102 | |
103 |
|
104 |
|
105 |
|
106 |
|
107 |
|
108 |
|
109 | options: {
|
110 |
|
111 |
|
112 | fallbackLng: 'default',
|
113 | backend: {
|
114 | 'loadPath': 'project/locales/{{lng}}/{{ns}}.json',
|
115 | },
|
116 | detection: {
|
117 |
|
118 | order: ['querystring'],
|
119 |
|
120 | lookupQuerystring: 'lang',
|
121 | },
|
122 | debug: false,
|
123 | },
|
124 | middlewareOptions: {
|
125 | ignoreRoutes: ['api/', 'assets/', 'dist/', 'proto/'],
|
126 | },
|
127 | },
|
128 | },
|
129 | };
|
130 | const warnings = [];
|
131 |
|
132 |
|
133 | function checkConfig(config) {
|
134 | if (config.code.compatibility) {
|
135 | warnings.push('Browserslist configuration has to be placed in `package.json`');
|
136 | }
|
137 | if (warnings.length) {
|
138 | console.warn('-------------------------------------------------------');
|
139 | console.warn('Attention:');
|
140 | warnings.forEach((string) => console.warn(`- ${string}`));
|
141 | console.warn('-------------------------------------------------------');
|
142 | }
|
143 | }
|
144 |
|
145 |
|
146 |
|
147 | const config = extend(true, {}, defaultConfig);
|
148 | checkConfig(config);
|
149 |
|
150 | module.exports = config;
|