CSS автоматически связывается с HTML с помощью Rails - PullRequest
0 голосов
/ 03 августа 2020

Я создал файл style. css в app / assets / stylesheets для моего проекта Ruby on Rails. Я добавил немного стиля и запустил сервер. Я не помещал <link href...> или stylesheet_link_tag в любой файл html .erb, но на каждой странице были изменения css, которые я написал в стиле. css

Кроме того, теперь у меня есть для перезапуска сервера каждый раз, когда я вношу изменения в CSS, чтобы увидеть эти изменения в браузере. Кто-нибудь сталкивался с этим раньше? Кстати, я использую экшн-кабель. У меня также нет папки public / assets.

application. js

require("@rails/ujs").start()
require("turbolinks").start()
require("@rails/activestorage").start()
require("channels")

require("jquery")
$(document).on('turbolinks:load', function () {
    alert("Hello!");
})

application. css

/*
 * 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, 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 other CSS/SCSS
 * files in this directory. Styles in this file should be added after the last require_* statement.
 * It is generally better to create a new file per style scope.
 *
 *= require_tree .
 *= require_self
 */

style. css

table{
    border-collapse: collapse;
}

table, th, td{
    border: 1px solid black;
}

#left, #right {float:left}
#left {width: 30%;}
#right {width: 70%;}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...