Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit 24aa5f2

Browse files
clarkdoatinux
authored andcommitted
feat: add rendering mode (#10)
* refactor: reconcile editorconfig with nuxt * feat: add rendering mode
1 parent eed20ec commit 24aa5f2

File tree

6 files changed

+40
-32
lines changed

6 files changed

+40
-32
lines changed

Diff for: .editorconfig

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
root = true
22

33
[*]
4-
indent_style = tab
4+
indent_style = space
55
indent_size = 2
66
end_of_line = lf
77
charset = utf-8
88
trim_trailing_whitespace = true
99
insert_final_newline = true
1010

11-
[{package.json,*.yml,*.md}]
12-
indent_style = space
13-
indent_size = 2
11+
[*.md]
12+
trim_trailing_whitespace = false

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"authors": [
2828
"Egoist <[email protected]>",
2929
"Nuxt team <[email protected]>",
30-
"Clark Du"
30+
"Clark Du <[email protected]>"
3131
],
3232
"license": "MIT"
3333
}

Diff for: sao.js

+9
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,15 @@ module.exports = {
5252
],
5353
default: 'none'
5454
},
55+
mode: {
56+
message: 'Choose rendering mode',
57+
type: 'list',
58+
choices: [
59+
{name: 'Universal', value: 'universal'},
60+
{name: 'Single Page App', value: 'spa'}
61+
],
62+
default: 'universal'
63+
},
5564
axios: {
5665
message: 'Use axios module',
5766
type: 'list',

Diff for: template/.editorconfig

+3-4
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22
root = true
33

44
[*]
5-
indent_style = tab
5+
indent_style = space
66
indent_size = 2
77
end_of_line = lf
88
charset = utf-8
99
trim_trailing_whitespace = true
1010
insert_final_newline = true
1111

12-
[{package.json,*.yml,*.md}]
13-
indent_style = space
14-
indent_size = 2
12+
[*.md]
13+
trim_trailing_whitespace = false

Diff for: template/.eslintrc.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ module.exports = {
1212
],
1313
// add your custom rules here
1414
rules: {
15-
'space-before-function-paren': [
15+
'space-before-function-paren': [
1616
2,
1717
{
1818
anonymous: 'always',
1919
named: 'never'
2020
}
2121
],
22-
},
22+
},
2323
globals: {}
2424
}

Diff for: template/nuxt.config.js

+22-21
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const pkg = require('./package')
22

33
module.exports = {
4+
mode: "<%= mode %>",
45
/*
56
** Headers of the page
67
*/
@@ -29,32 +30,32 @@ module.exports = {
2930
'~/assets/css/tailwind.css'<% } %>
3031
],
3132

32-
/*
33-
** Plugins to load before mounting the App
34-
*/
33+
/*
34+
** Plugins to load before mounting the App
35+
*/
3536
plugins: [<% if (ui === 'element-ui') { %>
3637
'@/plugins/element-ui'<% } else if (ui === 'vuetify') { %>
3738
'@/plugins/vuetify'<% } %>
3839
],
3940

40-
/*
41-
** Nuxt.js modules
42-
*/
41+
/*
42+
** Nuxt.js modules
43+
*/
4344
modules: [<% if (axios === 'yes') { %>
4445
// Doc: https://github.com/nuxt-community/axios-module#usage
4546
'@nuxtjs/axios'<% } %><% if (ui === 'bootstrap') { %>,
4647
// Doc: https://bootstrap-vue.js.org/docs/
4748
'bootstrap-vue/nuxt'<% } %><% if (ui === 'bulma') { %>,
48-
// Doc:https://github.com/nuxt-community/modules/tree/master/packages/bulma
49-
'@nuxtjs/bulma'<% } %>
49+
// Doc:https://github.com/nuxt-community/modules/tree/master/packages/bulma
50+
'@nuxtjs/bulma'<% } %>
5051
],<% if (axios === 'yes') { %>
5152

52-
/*
53-
** Axios module configuration
54-
*/
53+
/*
54+
** Axios module configuration
55+
*/
5556
axios: {
5657
// See https://github.com/nuxt-community/axios-module#options
57-
},<% } %>
58+
},<% } %>
5859

5960
/*
6061
** Build configuration
@@ -64,15 +65,15 @@ module.exports = {
6465
** You can extend webpack config here
6566
*/
6667
extend (config, ctx) {
67-
<% if (eslint === 'yes') { %>// Run ESLint on save
68-
if (ctx.isDev && ctx.isClient) {
69-
config.module.rules.push({
70-
enforce: 'pre',
71-
test: /\.(js|vue)$/,
72-
loader: 'eslint-loader',
73-
exclude: /(node_modules)/
74-
})
75-
}<% } %>
68+
<% if (eslint === 'yes') { %>// Run ESLint on save
69+
if (ctx.isDev && ctx.isClient) {
70+
config.module.rules.push({
71+
enforce: 'pre',
72+
test: /\.(js|vue)$/,
73+
loader: 'eslint-loader',
74+
exclude: /(node_modules)/
75+
})
76+
}<% } %>
7677
}
7778
}
7879
}

0 commit comments

Comments
 (0)