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

feat(build): provide siteConfig in transformPageData context #2163

Merged
merged 3 commits into from
Mar 29, 2023
Merged

feat(build): provide siteConfig in transformPageData context #2163

merged 3 commits into from
Mar 29, 2023

Conversation

JohnCampionJr
Copy link
Contributor

Similar to buildEnd, allows config options access in transformPageData

@JohnCampionJr
Copy link
Contributor Author

PS if there's any way you could merge this for the next release, I'd be very thankful :)

@brc-dd
Copy link
Member

brc-dd commented Mar 29, 2023

siteConfig wasn't added because you'll anyway be writing that hook in your config file, so you can just access the variables from there?

const config = defineConfig({
  // ...
  async transformPageData(pageData) {
    console.log(config.something)
  }
})

export default config

Or maybe if you don't wanna self-reference the config, just store what you want to access in a variable?

const foo = 'something'

export default defineConfig({
  title: foo,

  async transformPageData(pageData) {
    console.log(foo)
  }
})

@brc-dd brc-dd changed the title Add siteConfig to transformPageData feat(build): provide siteConfig in transformPageData context Mar 29, 2023
@brc-dd brc-dd merged commit 4cebef3 into vuejs:main Mar 29, 2023
@JohnCampionJr JohnCampionJr deleted the transform-config branch March 29, 2023 16:00
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants