Skip to content

Commit f139bc8

Browse files
[init] WordPress 模板
0 parents  commit f139bc8

File tree

2,151 files changed

+656911
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,151 files changed

+656911
-0
lines changed

.env

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
COMPOSE_PROJECT_NAME=es_nuxt
2+
3+
WP_PORT=9000
4+
WP_PORT_PHP_MY_ADMIN=9080
5+
6+
WP_MYSQL_DATABASE=esdata
7+
WP_MYSQL_USERNAME=es_admin
8+
WP_MYSQL_PASSWORD=es_admin
9+
WP_MYSQL_ROOT_PASSWORD=root
10+
11+
WP_DEBUG=true

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.DS_Store
2+
.DS_Store?
3+
4+
wordpress/wp-content/uploads
5+
wp-config.php

.vscode/extensions.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"recommendations": ["Vue.volar"]
3+
}

.vscode/settings.json

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{
2+
"search.exclude": {
3+
"wordpress/wp-content/plugins/": true,
4+
"wordpress/wp-include/": true,
5+
"wordpress/wp-admin/": true
6+
},
7+
"editor.insertSpaces": true, // 強制輸入空白
8+
"editor.detectIndentation": false, // 關閉縮排偵測
9+
"editor.tabSize": 4, // 編輯器字體大小
10+
"editor.formatOnSave": false,
11+
// ----- eslint, stylelint 設定 -----
12+
"eslint.alwaysShowStatus": true,
13+
"eslint.options": {
14+
"extensions": [".html", ".js", ".vue"]
15+
},
16+
"eslint.workingDirectories": [
17+
// 指定 ESLint 執行的工作目錄
18+
"."
19+
],
20+
"editor.codeActionsOnSave": {
21+
"source.fixAll.eslint": true,
22+
"source.fixAll.stylelint": true
23+
},
24+
"css.validate": false,
25+
"less.validate": false,
26+
"scss.validate": false,
27+
"stylelint.snippet": ["css", "scss", "vue"],
28+
"stylelint.validate": ["css", "scss", "vue"],
29+
// ----- Todo tree 設定 -----
30+
"todo-tree.highlights.defaultHighlight": {
31+
"foreground": "white",
32+
"type": "text"
33+
},
34+
"todo-tree.general.tags": ["TODO", "FIXME", "BUG", "API", "MOCK", "REF", "NOTICE"],
35+
"todo-tree.highlights.customHighlight": {
36+
"TODO": {
37+
"background": "#f0be29"
38+
},
39+
"FIXME": {
40+
"icon": "$(flame)",
41+
"background": "#f765ab"
42+
},
43+
"BUG": {
44+
"icon": "$(bug)",
45+
"background": "#ff0000"
46+
},
47+
"API": {
48+
"icon": "$(cloud-download)",
49+
"background": "#D94DFF"
50+
},
51+
"MOCK": {
52+
"icon": "$(squirrel)",
53+
"background": "#4cf21a"
54+
},
55+
"REF": {
56+
"icon": "$(hubot)",
57+
"background": "#00ddff"
58+
},
59+
"NOTICE": {
60+
"background": "#ec9669"
61+
}
62+
},
63+
"todo-tree.filtering.excludeGlobs": ["**/node_modules/*", "**/wp-content/plugins/*"],
64+
"cSpell.words": ["blockstudio"]
65+
}

.vscode/template.code-snippets

+184
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
{
2+
// css
3+
// ------ rwd -----
4+
"SCSS RWD mixin large": {
5+
"scope": "scss, vue",
6+
"prefix": "xl",
7+
"body": [
8+
"@include media-breakpoint-down(large) {",
9+
"$1",
10+
"}"
11+
],
12+
"description": "rwd large"
13+
},
14+
"SCSS RWD mixin desktop": {
15+
"scope": "scss, vue",
16+
"prefix": "lg",
17+
"body": [
18+
"@include media-breakpoint-down(desktop) {",
19+
"$1",
20+
"}"
21+
],
22+
"description": "rwd desktop"
23+
},
24+
"SCSS RWD mixin tablet": {
25+
"scope": "scss, vue",
26+
"prefix": "md",
27+
"body": [
28+
"@include media-breakpoint-down(tablet) {",
29+
"$1",
30+
"}"
31+
],
32+
"description": "rwd tablet"
33+
},
34+
"SCSS RWD mixin mobile": {
35+
"scope": "scss, vue",
36+
"prefix": "xs",
37+
"body": [
38+
"@include media-breakpoint-down(mobile) {",
39+
"$1",
40+
"}",
41+
],
42+
"description": "rwd mobile"
43+
},
44+
// ----- header height -----
45+
"get header height": {
46+
"scope": "scss, vue",
47+
"prefix": "map:header-height",
48+
"body": [
49+
"map-get(\\$header-height, ${0:normal})"
50+
],
51+
"description": "flex align center"
52+
},
53+
// ----- UI guide -----
54+
"typography mixin": {
55+
"scope": "scss, vue",
56+
"prefix": "typo",
57+
"body": [
58+
"@include typo('$1', $2);"
59+
],
60+
"description": "typography mixin"
61+
},
62+
"get font-weight": {
63+
"scope": "scss, vue",
64+
"prefix": "map:font-weight",
65+
"body": [
66+
"font-weight: map-get(\\$font-weight, $0);"
67+
],
68+
"description": "font-weight mixin"
69+
},
70+
"get font-family": {
71+
"scope": "scss, vue",
72+
"prefix": "map:font-family",
73+
"body": [
74+
"font-family: map-get(\\$font-family, $0);"
75+
],
76+
"description": "font-family mixin"
77+
},
78+
"get color": {
79+
"scope": "scss, vue",
80+
"prefix": "map:color",
81+
"body": [
82+
"map-get(\\$colors, $0)"
83+
],
84+
"description": "flex align center"
85+
},
86+
// ----- mixins -----
87+
"SCSS size mixin": {
88+
"scope": "scss, vue",
89+
"prefix": "size",
90+
"body": [
91+
"@include size($1);"
92+
],
93+
"description": "size mixin"
94+
},
95+
"vue transition css": {
96+
"scope": "scss, vue",
97+
"prefix": "vue-transition",
98+
"body": [
99+
"$1 {",
100+
" &-enter {",
101+
" &-active {",
102+
" }",
103+
" &-to {",
104+
" }",
105+
" }",
106+
" &-leave {",
107+
" &-active {",
108+
" }",
109+
" &-to {",
110+
" }",
111+
" }",
112+
"}"
113+
],
114+
"description": "vue transition scss"
115+
},
116+
// ----- css -----
117+
"flex center": {
118+
"scope": "scss, vue",
119+
"prefix": "flex-center",
120+
"body": [
121+
"display: flex;",
122+
"align-items: center;",
123+
"justify-content: center;",
124+
],
125+
"description": "flex align center"
126+
},
127+
"SCSS bg-cover mixin": {
128+
"scope": "scss, vue",
129+
"prefix": "bg-cover",
130+
"body": [
131+
"background: url('$0') center center / cover no-repeat;"
132+
],
133+
"description": "background cover mixin"
134+
},
135+
// ----- html -----
136+
"fakeImg": {
137+
"prefix": "fakeimg",
138+
"body": ["${1:https://source.unsplash.com/random/${2:1024}x${3:768}}"],
139+
"description": "fakeImg"
140+
},
141+
"targetBlank": {
142+
"prefix": "target-blank",
143+
"body": ["target=\"_blank\" rel=\"noopener noreferer nofollow\""],
144+
"description": "開啟新視窗"
145+
},
146+
"targetBlankInside": {
147+
"prefix": "target-blank-inside",
148+
"body": ["target=\"_blank\" rel=\"noopener\""],
149+
"description": "開啟新視窗"
150+
},
151+
"v-for": {
152+
"prefix": "for",
153+
"body": [
154+
"v-for=\"(item, key) in items\"",
155+
":key=\"key\""
156+
],
157+
"description": "v-for"
158+
},
159+
"template": {
160+
"prefix": "tem",
161+
"body": [
162+
"<template>",
163+
" <div class=\"template\">",
164+
"",
165+
" </div>",
166+
"</template>",
167+
"<script setup>",
168+
" const props = defineProps({",
169+
" template: {",
170+
" type: Object,",
171+
" default: {},",
172+
" },",
173+
" })",
174+
"</script>",
175+
"<style lang=\"scss\">",
176+
" $$class-name: template;",
177+
" .#{$$class-name} {",
178+
"",
179+
" }",
180+
"</style>",
181+
],
182+
"description": "template"
183+
}
184+
}

README.md

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# ES Nuxt3 WordPress
2+
3+
## 安裝步驟
4+
1. 到 .env 檔設定基本環境
5+
2. docker-compose up -d
6+
3. cd nuxt-app
7+
4. yarn && yarn dev
8+
5. 專案啟動在
9+
nuxt localhost:3000,
10+
wordpress localhost:9000/wp-admin
11+
12+
## 資料庫輸出
13+
1. `sh dump.sh` 將 docker VM 的 DB 資料匯出至 `/db/default/wp.sql`
14+
15+
## 前端上傳步驟
16+
1. stash 未commit的檔案後切換至 `deploy` 分支
17+
2. rebase `deploy``master`
18+
3. 確認於 `deploy` 分支下 `yarn build`
19+
4. commit `/.output` 所有檔案
20+
5. 連線主機
21+
6. 於專案資料夾下`/project-name` 輸入 `git reset --hard origin/deploy``git pull origin deploy`
22+
7. 開啟 `pm2` 可以先 `pm2 delete project-name`,或者直接 `pm2 restart project-name`
23+
8. 沒有開過 `pm2``cd /project-name/nuxt-app` 輸入 `pm2 start --env prod`
24+
25+
## Git Commit Type 規範
26+
27+
1. feat: 新增/修改功能 (feature)。
28+
2. fix: 修補 bug (bug fix)。
29+
3. docs: 文件,增加說明 (documentation)。
30+
4. backup: 備份。EX: SQL檔案
31+
5. data: 資料變化。EX:圖片、固定文案、動態資料
32+
6. style: 格式 (不影響程式碼運行的變動 white-space, formatting, missing semi colons, etc)。
33+
7. refactor: 重構 (既不是新增功能,也不是修補 bug 的程式碼變動)。
34+
8. perf: 改善效能 (A code change that improves performance)。
35+
9. test: 增加測試 (when adding missing tests)。
36+
10. chore: 建構程序或輔助工具的變動 (maintain)。
37+
11. revert: 撤銷回覆先前的 commit 例如:revert: type(scope): subject (回覆版本:xxxx)。
38+
12. deploy: 部署相關檔案
39+
40+

backup/index.php

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
/**
3+
* Front to the WordPress application. This file doesn't do anything, but loads
4+
* wp-blog-header.php which does and tells WordPress to load the theme.
5+
*
6+
* @package WordPress
7+
*/
8+
9+
/**
10+
* Tells WordPress to load the WordPress theme and output it.
11+
*
12+
* @var bool
13+
*/
14+
define( 'WP_USE_THEMES', true );
15+
16+
/** Loads the WordPress Environment and Template */
17+
require __DIR__ . '/wp-blog-header.php';

0 commit comments

Comments
 (0)