Skip to content

Commit

Permalink
Fix global variable issue
Browse files Browse the repository at this point in the history
  • Loading branch information
JaroCamphuijsen committed Sep 19, 2023
1 parent 755969f commit dfebbee
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion components/Banner.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<div class="flex font-display font-semibold pt-12 pl-10">
<div v-if="$route.path === '/'">
<h1 class="text-4xl text-eSciencePurple">
{{ $config.title }} Lessons
{{ $config.public.title }} Lessons
</h1>
</div>
</div>
Expand Down
4 changes: 3 additions & 1 deletion config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

{
"myConfig":
{
"title": "Essentials for Research Software Support",
"categoryOrder": ["Getting started", "Reusability", "Publishing & Citing", "Resources", "Examples"],
"another": "foo bar baz"
}
}
7 changes: 5 additions & 2 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
// https://nuxt.com/docs/api/configuration/nuxt-config
import config from './config.json'
import { myConfig } from './config.json'

export default defineNuxtConfig({
runtimeConfig: config,
runtimeConfig: {
public: myConfig,
}
,

devtools: { enabled: true,
pages: true },
Expand Down
2 changes: 1 addition & 1 deletion pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<main>
<Banner />
<ContentDoc />
Testing import from the config file: {{ $config.another }}
Testing import from the config file: {{ $config.public.another }}
</main>
</template>
<script>
Expand Down

0 comments on commit dfebbee

Please sign in to comment.