简体   繁体   English

如何在rails的application.css文件ruby中加载style.scss文件

[英]How to load style.scss file in application.css file ruby on rails

I have ruby on rails project in which I want to include scss files in my style sheets that is application.css 我在ruby on rails项目中想在我的样式表中包含scss文件,即application.css。

The directory structure is look like below: 目录结构如下所示:

在此处输入图片说明

The problem is that when I try to do this in my application.css file: 问题是,当我尝试在application.css文件中执行此操作时:

 *= require font-awesome
 *= require bootstrap
 *= require slick
 *= require basic-theme
 *= require style
 *= require_self


@import url("style.scss"); //it is in scss folder.

it still does not parse the code in it. 它仍然不解析其中的代码。 Also if I set the path with assets/ it does load it but gives error like: 另外,如果我使用资源设置路径/它确实会加载它,但会给出如下错误:

Sass::SyntaxError in Home#index

Undefined variable: "$base-font".

How I can easily import all these scss files in my rails app? 如何在Rails应用程序中轻松导入所有这些scss文件? Also any best practices please? 还有任何最佳做法吗?

相反,您需要使用

@import "<relative path to style.css without .scss>"

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 @import不适用于Rails项目中的“ application.css.scss”文件,仅作为“ application.css”工作 - @import not working for my “application.css.scss” file in Rails project, only works as “application.css” 当文档要求在application.css中要求文件时,如何在application.scss中要求文件 - How to require files in application.scss when the docs call for the file to be required in application.css 带Bootstrap的Rails(在Windows上)-空的application.css文件和样式不会加载 - Rails with Bootstrap (on Windows) - empty application.css file and styling won't load Ruby on Rails-覆盖application.css - Ruby on Rails - Override application.css 如何在Ruby on Rails中将scss文件与样式表链接标记链接起来 - How to link scss file with style sheet link tag in Ruby on Rails 如何解决“错误:找不到要导入的文件或无法读取的文件:bootstrap-sprockets”。 在 Rails 中,无需修改 application.css - How to resolve "Error: File to import not found or unreadable: bootstrap-sprockets." in Rails WITHOUT modifying application.css 带有通用CSS的Ruby on Rails样式表呈现文件和application.css - Ruby on Rails stylesheet rendering files and application.css with common css Sass排除页面的application.css文件 - Sass excluding application.css file for a page 在资产管道Rails 4 application.css和application.css.scss中手动要求&#39;Bootsy&#39; - manually require 'Bootsy' in assets pipeline Rails 4 application.css vs application.css.scss Rails没有加载application.css - Rails not loading application.css
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM