Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue / Nuxt as SPA #58

Merged
merged 8 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .theme/components/Prose/ProseBlockquote.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ const slot = computed(() => {

const firstLine = computed(() => {
// avoids multiple rendering of default slot in children
return slot.value[0].children.default()[0].children;
return slot.value[0].children.default()[0].children[0].children;
});

const types = {
":information_source:": "info",
":warning:": "warning",
":bulb:": "success"
"!NOTE": "info",
"!WARNING": "warning",
"!TIP": "success"
};

const type = computed(() => {
Expand All @@ -46,13 +46,13 @@ blockquote {
margin-left: 1em;
}
.info {
border-color: var(--color-blue);
border-color: var(--color-blue-n1);
}
.warning {
border-color: var(--color-orange);
border-color: var(--color-orange-0);
}
.success {
border-color: var(--color-green);
border-color: var(--color-green-n1);
}
.default {
border-color: var(--color-fg);
Expand Down
38 changes: 28 additions & 10 deletions .theme/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,28 @@ export default defineNuxtConfig({
remarkPlugins: {
"remark-emoji": false
}
},
highlight: {
theme: "slack-dark",
preload: [
"diff",
"ts",
"js",
"css",
"java",
"markdown",
"sql",
"xml",
"json",
"csharp",
"md",
"bash",
"dockerfile"
]
}
},
css: ["~/assets/styles.scss"],
devtools: { enabled: true },
vite: {
css: {
preprocessorOptions: {
scss: {
additionalData: "@import \"@/assets/variables.scss\";"
}
}
}
},
modules: ["@nuxt/content", "@pinia/nuxt"],
dir: {
public: ".public"
},
Expand All @@ -75,6 +83,7 @@ export default defineNuxtConfig({
generate: {
routes: ["/not-found"]
},
modules: ["@nuxt/content", "@pinia/nuxt"],
nitro: {
prerender: {
ignore: [
Expand All @@ -101,5 +110,14 @@ export default defineNuxtConfig({
},
baseUrl: ""
}
},
vite: {
css: {
preprocessorOptions: {
scss: {
additionalData: "@import \"@/assets/variables.scss\";"
}
}
}
}
});
21 changes: 20 additions & 1 deletion .theme/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions .theme/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
"type": "module",
"scripts": {
"lint": "eslint .",
"setup": "npm run lint && npx cross-var node -r dotenv/config prebuild dotenv_config_path=.env.$npm_config_env",
"setup": "npm run lint && cross-env-shell node -r dotenv/config prebuild dotenv_config_path=.env.$npm_config_env",
"predev": "npm run setup --env=local",
"dev": "npx nuxi dev --dotenv .env.local",
"pregenerate": "npx cross-var npm run setup --env=$npm_config_env",
"generate": "npx cross-var npx nuxi generate --dotenv .env.$npm_config_env",
"dev": "nuxi dev --dotenv .env.local",
"pregenerate": "cross-env-shell npm run setup --env=$npm_config_env",
"generate": "cross-env-shell nuxi generate --dotenv .env.$npm_config_env",
"generate:local": "npm run generate --env=local",
"generate:production": "npm run generate --env=production",
"postinstall": "npx nuxi prepare",
"postinstall": "nuxi prepare",
"prelocal": "npm run generate:local",
"local": "npx http-server .output/public -p 3000"
},
Expand All @@ -20,6 +20,7 @@
"@nuxt/devtools": "latest",
"@nuxtjs/eslint-config-typescript": "^12.1.0",
"@pinia/nuxt": "^0.5.3",
"cross-env": "^7.0.3",
cihandeniz marked this conversation as resolved.
Show resolved Hide resolved
"eslint": "^8.57.0",
"log-symbols": "^6.0.0",
"nuxt": "3.12.4",
Expand Down
8 changes: 0 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ run:
@ \
echo "(1) Dev" ; \
echo "(2) Local" ; \
echo "(3) Eslint" ; \
echo "(4) Eslint Fix" ; \
echo "" ; \
echo "Please select 1-4: " ; \
read srv ; \
Expand All @@ -14,12 +12,6 @@ run:
fi ; \
if test $$srv -eq "2" ; then \
cd .theme ; npm run local ; cd .. ; \
fi ; \
if test $$srv -eq "3" ; then \
cd .theme ; npm run lint ; cd .. ; \
fi ; \
if test $$srv -eq "4" ; then \
cd .theme ; npx eslint . --fix ; cd .. ; \
fi
build:
@ \
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Read below guides to find out how we use nuxt;
- [Routing](routing.md)
- [Components](components.md)
- [Network](network.md)
- [Single-Page Application (SPA)](spa.md)
- [Configuration](configuration.md)

Enjoy your web site project 🤗
Expand Down
4 changes: 2 additions & 2 deletions change-history/package-upgrades.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ Added it because it is needed for the `log` task in `.prebuild`.

When upgrading to this version, version 3.4.1 of nuxt gives run time errors.

```log
```text
WARN Current version of Node.js (20.8.0) is unsupported and might cause
issues.
Please upgrade to a compatible version (^14.18.0 || ^16.10.0 || ^17.0.0 ||
Expand Down Expand Up @@ -172,7 +172,7 @@ Clean upgrade. No issues.
When we upgraded the Typescript version to 5.2.2 there was a conflict with
eslint. You can see the problem below.

```log
```text
=============

WARNING: You are currently running a version of TypeScript which is not
Expand Down
12 changes: 6 additions & 6 deletions components.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ properties can be added later on. Values of these properties can be assigned
when using the component with properties as shown in
`.theme/demo/defining-props.vue`

> :information_source:
> [!NOTE]
>
> When we use `defineProps`, we prefer the language to be `typescript` to keep
> the props type-safe.
Expand All @@ -41,7 +41,7 @@ Complex types can be used with `defineProps` as seen in
Demo is at
[/demo/components/complex-type-props](/demo/components/complex-type-props)

> :information_source:
> [!NOTE]
>
> For type instances in your scripts to work, script language should be set
> to TypeScript. [TypeCheck][] should be enabled. If you have enabled type
Expand Down Expand Up @@ -95,7 +95,7 @@ Below is a demonstration of overriding `ProseTable.vue`;
| Using | Prose | Components |
| To | Add | Border |

> :information_source:
> [!NOTE]
>
> You need to configure `~/components/Prose` as a global directory to enable
> this. See `.theme/nuxt.config.ts`.
Expand All @@ -105,7 +105,7 @@ Below is a demonstration of overriding `ProseTable.vue`;
We need this one to create an alarm component out of a blockquote with an icon
in its first line like below;

> :warning:
> [!WARNING]
>
> Demo warning message

Expand All @@ -119,7 +119,7 @@ changed or created.

Other types demonstrated below;

> :information_source:
> [!NOTE]
>
> Demo info message

Expand Down Expand Up @@ -161,7 +161,7 @@ See [/demo/transformer](/demo/transformer/) to see what can be done.

See `/transformers/optimus-prime.ts` to see how it is done.

> :information_source:
> [!NOTE]
>
> For Content Transformers to work, we need to add them as modules to Nuxt.
> Nuxt does this automatically if the nuxt modules are under `/modules`. You
Expand Down
2 changes: 1 addition & 1 deletion configuration.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
position: 7
position: 8
---

# Configuration
Expand Down
2 changes: 1 addition & 1 deletion content.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Code references are given in code block such as `const x = ref(5);`. To use
code block wrap the code with "\`" character. This usage works for a single
line, in order to have multiple lines of code block use "\`\`\`" instead of "\`".

> :information_source:
> [!NOTE]
>
> Code related terms and terms in general are not given in code block,
> use "\_\_Term\_\_" for code related terms, and italic for terms in general.
Expand Down
Loading