Привет, У меня возникли проблемы с загрузкой моего css в моем базовом приложении. Я сделал rails g controller static_pages
Это дало мне static_pages.scss, который по умолчанию должен быть загружен конвейером активов? У меня есть require_tree. в моем application.css файле:Почему мой базовый css в моем приложении rails загружается?
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
* compiled file so the styles you add here take precedence over styles defined in any styles
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
* file per style scope.
*
*= require_tree .
*= require_self
*/
Вот мой static_pages.scss файл:
// Place all the styles related to the static_pages controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
body {
background-color: red;
}
И когда я осматриваю static_pages # домашней страницы фон белый, так что CSS не загружается.
А вот мой application.html.erb:
<!DOCTYPE html>
<html>
<head>
<title>t</title>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<%= csrf_meta_tags %>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
</head>
<body class="container-fluid">
<%= yield %>
</body>
</html>
Я не сделал каких-либо изменений в конфигурацию приложения. Спасибо за помощь.
Вы перезапустили свой веб-сервер? – davideghz
Да, я перезапустил его несколько раз – srlrs20020
Я искал googled и нашел это: 'RAILS_ENV = разработка rake assets: clean' - запустить его в вашем терминале. Это должно удалить созданные файлы CSS и заставить рельсы восстанавливать вывод CSS из ваших файлов Sass или SCSS. – davideghz