NextJs and Bulma UI #15731
-
This is my first time building a NextJs app from scratch. I have an HTML, CSS, Javascript template done with Bulma CSS which I intend to bring directly into my NextJS app using _document.js file with the link and script tags. Steps taken I created a new NextJs template using yarn create next-app, copied my existing assets folder into public folder path, created _document.js, and imported my assets with link and script tags. The assets are loaded into my resources when I checked the Network tab in my browser dev mode but the page is blank. What I intend to achieve I want to bring in all assets including the existing Javascript files to reduce my stress as I have very small time to deliver the project |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
You can import CSS in https://github.com/chibicode/existing-html-css But this might not work because 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. |
Beta Was this translation helpful? Give feedback.
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.