简体   繁体   中英

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

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.

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, eg:

/All Projects/randomqotesproject/

It should work.

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM