4

I'm building a simple site for a school project using next, and I managed to deploy the next.js app using now, but no styles are being applied. Everything is fine and works (looks) great on localhost but not online (https://spa-ot24z7ugt.now.sh).

I guess it has something to do with the now.json file, but their documentation makes it look like everything will just work out of the box, and it kind of is true, except for the styling. I looked at the documentation and could not find anything and I was wondering if anyone has any experience using now and next.js.

my now.json file:

```{
  "version": 2,
  "builds": [
    { "src": "next.config.js", "use": "@now/next" }
  ]
}```

link to the deployed site: https://spa-ot24z7ugt.now.sh

I'm using Head from 'next/head' to generate link a static CSS file.

2 Answers 2

1

I had the same issue and the fix for me was to include style.css as static build:

{
    "version": 2,
    "name": "wp-nextjs",
    "public": true,
    "builds": [
        { "src": "package.json", "use": "@now/next" },
        { "src": "static/css/style.css", "use": "@now/static" }
    ]
}
Sign up to request clarification or add additional context in comments.

Comments

1

For me "_" dirs were being ignored.

Files with an _ as prefix (like _next, _css, _js) are special for jekyll. You can bypass this by creating a .nojekyll file in the root of your gh-pages repo and pushing it to GitHub.

Refer : https://github.blog/2009-12-29-bypassing-jekyll-on-github-pages/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.