Report this

What is the reason for this report?

Website Hosting on Digital Ocean App Not Recognising CSS Files in Folder

Posted on December 23, 2023

Hey Team,

I’ve just started using Digital Ocean and have used the ‘Apps’ function to host my website from a GitHub repo. It deployed successfully, however when the style.css file is located in CSS folder it doesn’t load, however if I move the style.css file to the root folder it loads normally.

When looking in the sources tab of the inspect element it’s showing that the CSS folder isn’t loading at all.

My portfolio website is https://danagnew.co.nz

Any help or advice around this would be amazing!

Cheers, Dan Agnew



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hey Dan,

First off, congrats on getting your portfolio website up and running with DigitalOcean’s App Platform! It’s great that you’ve successfully deployed your site! Let’s try and troubleshoot the CSS issue, here are the first things that I would recommend checking:

  1. Double-check the path to your CSS files in your HTML. If your CSS files are in a CSS folder, the link in your HTML should look something like this:

    <link rel="stylesheet" href="/css/style.css">
    

    Make sure the path correctly reflects the folder structure in your GitHub repo.

  2. Paths on servers are often case-sensitive. If your folder is named CSS but your HTML is referencing css, it won’t find the files. Ensure that the case matches exactly.

  3. Use your browser’s developer tools to check the network requests for your CSS files. This can give you clues as to whether the files are not found (404 errors) or if there’s another issue.

  4. In the DigitalOcean App Platform, check your build and publish settings. Make sure that the publish directory is set correctly to include your CSS folder. Sometimes, if the publish directory is set to the root, it may not include subdirectories by default.

  5. Verify that your GitHub repository’s structure is as you expect and that the CSS folder is not in a .gitignore file or excluded in some other way.

  6. If you’re using relative paths, try switching to absolute paths (or vice versa) to see if that resolves the issue. Sometimes path resolution can behave differently in a deployed environment versus a local environment.

After making changes, re-deploy your app. Sometimes, a simple re-deployment can fix path issues.

Best of luck, Dan! Let me know how it goes!

Best,

Bobby

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.