Skip to content
Discussion options

You must be logged in to vote

You can import CSS in pages/_app.js and import JS files from your page components as I did in this repo:

https://github.com/chibicode/existing-html-css

But this might not work because window is not defined when it’s pre-rendered. In that case, you can try importing JS files in a public directory:

https://github.com/chibicode/existing-html-css-public

(see this line: https://github.com/chibicode/existing-html-css-public/blob/7dabb6521ffc304052c7a7e5576f04106a48614c/pages/_document.js#L11)

However, I think your existing HTML + JavaScript might need to be converted to React components, especially if your existing JavaScript modifies your DOM.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by AsiwajuDev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants