css - (sass) :26096 How to fix 'Sass::SyntaxError: Invalid CSS after' error in Rails

标签 css sass ruby-on-rails-5.2 precompile

我在本地运行这个

rake assets:precompile --trace RAILS_ENV=production

ruby :2.6.3

导轨:5.2.2

bundler :2.0.2

美洲狮:3.12.1

这是我的CSS 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
 */
*= require font-awesome.css
*= require bootstrap.css
*= require font-awesome.css
*= require lineicons.css
*= require mystyles.css
*= require styles.css
*= require weather-icons.css

错误日志

Sass::SyntaxError: Invalid CSS after "...ather-icons.css": expected "{", was ""
(sass):26096

我希望在运行 rake assets:precompile --trace RAILS_ENV=production 时成功

最佳答案

我认为你应该将 application.css 重命名为 application.scss 并删除 require tree 和 require self

关于css - (sass) :26096 How to fix 'Sass::SyntaxError: Invalid CSS after' error in Rails,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56872571/

相关文章:

css - IE9 中这些@font-face 字体有什么问题?

html - 使用目录和子目录的结构生成完整的 HTML 网站

javascript - 图片上方的半透明div

css - 图像在圆形图像上被拉伸(stretch) - Bootstrap 和 SCSS

css - Bootstrap 按钮处于事件状态且目标样式不起作用

html - CSS:多行文本上的透明背景色,没有难看的重叠或行间空格

CSS悬停对旋转div的影响

ruby-on-rails - Rails ActionMailer 使用 API 方法而不是 SMTP - SendGrid

ruby-on-rails - 创建具有 has_one 关系的 FactoryBot 用户

rails-api - Rails 5.2 Rest API + Active Storage + React - 将附件 url 添加到 Controller 响应