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

pagePath not properly resolved? #108

Open
rowild opened this issue Sep 25, 2021 · 0 comments
Open

pagePath not properly resolved? #108

rowild opened this issue Sep 25, 2021 · 0 comments

Comments

@rowild
Copy link

rowild commented Sep 25, 2021

I have a setup with this configuration:

import { resolve } from "path";
import handlebars from "vite-plugin-handlebars";

const pageData = {
  "/src/pages/index.html": {
    title: "Homepage"
  },
  "/src/pages/subpage/index.html": {
    title: "Subpage"
  }
};

const handlebarsOptions = {
  context(pagePath) {
    console.log("pagePath =", pagePath);
    return pageData[pagePath];
  },
  partialDirectory: resolve(__dirname, "src/pages/partials")
};

export default {
  plugins: [handlebars(handlebarsOptions)]
};

A codesandbox is here:
https://codesandbox.io/s/vite-with-handlebars-61te7

As the terminal shows, the console.log does not pick up the current configuration.

What am I doing wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant