gpt4 book ai didi

html - css 没有在 rails 4.2.5.1 中应用?

转载 作者:太空宇宙 更新时间:2023-11-04 10:42:58 25 4
gpt4 key购买 nike

“我在 rails 中生成 Controller ,它会为我生成 css,但是当我在 Assets /样式表 controller_name.scss.css 中添加 css 时,它不会被包含在内,但是当我将它本身添加到 html 文件中时,它会到达那里。”

“这是我的 controller_name.scss.css 文件”

// Place all the styles related to the boo controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
h1 { color:#77eeff;
text-align: center;
text-decoration: underline;}

这是 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, 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
*/
/*

最佳答案

请将“controller_name.scss.css”文件更改为“controller_name.css.scss”,据我所知,预处理器扩展应该链接在末尾。此外,如果您的应用程序环境是“生产环境”,那么您必须运行:

bundle exec production rake assets:precompile

如果是开发,那么就运行:

抽取 Assets :预编译

查看有关 Assets 管道的 Rails 指南 here

关于html - css 没有在 rails 4.2.5.1 中应用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35667616/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com