Home > Mobile >  CSS and JS are not loading when i deploy the site on github, netlify
CSS and JS are not loading when i deploy the site on github, netlify

Time:07-20

https://github.com/MadhavaY/RandomQuotesGenerator here is the link to the repository. HTML is loading but css and js are not. Link to the website https://madhavay.github.io/RandomQuotesGenerator/. I saw other answers too but i could not get where am i going wrong.

CodePudding user response:

Hello madhava I reviewed your project and found out that you are still using your local paths to link your css and javascript

    <link rel='stylesheet' type='css' media='screen' href='/All Projects/randomqotesproject/randomquotes.css'>

just change /All Projects/randomqotesproject/randomquotes.css to ./randomquotes.css

CodePudding user response:

You need to change the path of both files. As is:

<script src="/All Projects/randomqotesproject/randomquotes.js"></script>

<link rel='stylesheet' type='css' media='screen' href='/All Projects/randomqotesproject/randomquotes.css'>

If you remove the path, e.g:

/All Projects/randomqotesproject/

It should work.

CodePudding user response:

If changing the path doesn't work for you, you can easily add a URL to the CSS and JS instead. EX: https://madhavay.github.io/RandomQuotesGenerator/randomquotes.css

  • Related