我在app/assets/stylesheets
中創建了一個css文件home_page.css.scss,並將標記<% stylesheet_link_tag 'home_page.css' %>
添加到了我的html.erb文件index.html.erb
。CSS未顯示在視圖中
當我運行rails服務器(在重新啓動以便CSS可以編譯後)時,我可以看到我的頁面的HTML內容爲localhost:3000
,但是CSS內容沒有找到的地方。
我的Rails應用程序的全部源代碼可以在GitHub上我可以查看是否有幫助:
https://github.com/adam-wanninger/tweet_down
我在做什麼錯?
這裏是index.html.erb
:
<!DOCTYPE html>
<html>
<head>
<% stylesheet_link_tag 'home_page.css' %>
<title>Tweet Down</title>
</head>
<body>
<h1>Tweet Down</h1>
<p>Tweet Down is a Ruby on Rails app built by me, Adam Wanninger. I built Tweet Down to be a basic (but stylish) Twitter feed for next years presidential candidates.</p>
<div>
<p id="dem_drop_down">Democratic Party Candidates<br>
<select name="democrat_menu" onChange="window.document.location.href=this.options[this.selectedIndex].value;" value="GO">
<option selected="selected">Bernie Sanders</option>
<option value="year/1">Hillary Clinton</option>
<option value="year/2">Michael Jackson</option>
</select>
</p>
</div>
<div>
<p id="rep_drop_down">Republican Party Candidates<br>
<select name="republican_menu" onChange="window.document.location.href=this.options[this.selectedIndex].value;" value="GO">
<option selected="selected">Ted Cruz</option>
<option value="URL">Jeb Bush</option>
<option value="URL">Jon Stamos</option>
</select>
</p>
</div>
</form>
</body>
</html>
上帝之母.........謝謝先生。 – FluffyKittens