簡體   English   中英

CSS和JS正在使用localhost,但不在Heroku Webserver上

[英]CSS and JS are working on localhost, but not on Heroku Webserver

伙計我一直在網絡平台上工作,我在部署到heroku服務器時遇到了一些問題。 雖然文件已上傳到heroku,但我的CSS和JS文件無法加載。

我正在使用PHP7和Bootstrap 4.0。 我已經驗證了CSS和JS鏈接的路徑。我實際上使用php include將我的head.php鏈接到我的主文件(index.php)。 這是代碼:

<!-- Bootstrap CSS First Try with the "relative" path used on heroku-->
<link rel="stylesheet" href="vendor/twbs/bootstrap/dist/css/bootstrap.min.css">
<!-- General CSS -->
<link rel="stylesheet" href="assets/css/main_style.css">
<!-- Fav Icon -->
<link rel="icon" type="image/png" sizes="32x32" href="assets/imgs/favicon-32x32.png">

<!-- Bootstrap CSS Second Try with the "absolute" path used on heroku-->`enter code here`
<link rel="stylesheet" href="https://whispering-waters.herokuapp.com/vendor/twbs/bootstrap/dist/css/bootstrap.min.css">
<!-- General CSS -->
<link rel="stylesheet" href="https://whispering-waters.herokuapp.com/assets/css/main_style.css">
<!-- Fav Icon -->
<link rel="icon" type="image/png" sizes="32x32" href="https://whispering-waters.herokuapp.com/assets/imgs/favicon-32x32.png">


<!-- Bootstrap CSS Third Try with CDN-->
<link rel="stylesheet" href="<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<!-- General CSS -->
<link rel="stylesheet" href="https://whispering-waters-50467.herokuapp.com/assets/css/main_style.css">
<!-- Fav Icon -->
<link rel="icon" type="image/png" sizes="32x32" href="https://whispering-waters-50467.herokuapp.com/assets/imgs/favicon-32x32.png">

我期待任何一個能修復Heroku上的CSS和JS加載。 我接受任何建議。 我提前謝謝了

我想到了。 問題是作曲家包管理。 我修復了項目作曲家依賴項,它開始工作了。 我意識到NodeJs npm和其他包管理器也會出現這個問題。 如果有人遇到同樣的問題,那么值得一試驗證您的包依賴性。

衷心感謝您的支持。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM