jekyll - 如何使用 Jekyll 将 CSS 导入 SCSS 文件?

这是 css 文件夹中的 style.scss,它正确地将所有导入合并到一个文件中到 _site/css/style.css但它不包括 normalize.css

只有当我将扩展名更改为 normalize.scss

时它才有效
---
---

@charset "utf-8";

@import "../../node_modules/normalize.css/normalize.css";
@import "variables";
@import "general";
@import "navigation";
@import "intro";

如果我像这样跳过扩展,那么 Jekyll 甚至不会编译(错误是无法导入未找到或不可读)

@import "../../node_modules/normalize.css/normalize";

如何使用 Jekyll 将 CSS 导入 SCSS 文件?

最佳答案

您可以在这篇文章中找到答案:Import regular CSS file in SCSS file?

来源:http://sass-lang.com/documentation/file.SASS_CHANGELOG.html#CSS__import_Directives

CSS @import Directives

Sass is now more intelligent about when to compile @import directives to plain > CSS. Any of the following conditions will cause a literal CSS @import:>

Importing a path with a .css extension (e.g. @import "foo.css").
Importing a path with a media type (e.g. @import "foo" screen;).
Importing an HTTP path (e.g. @import "http://foo.com/style.css").
Importing any URL (e.g. @import url(foo)).
The former two conditions always worked, but the latter two are new.

https://stackoverflow.com/questions/46531547/

相关文章:

ios - 准备在 UITabbarController 中不调用 segue

firebase - 我如何跟踪 firebase 和 bigquery 中的流行用户流?

html - 打印时将页脚放在底部

asp.net-mvc - ASP.NET Core 模型状态不返回 DataMember 名称

javascript - 使用 toLocaleTimeString() 以毫秒为单位显示时间

php - 第 0 行未知中的警告 : Unknown: Failed to write sessi

dataframe - 通过 [PySpark] 列连接两个 DataFrame

python - 使用矩阵作为鸭嘴兽 MOEA 的输入

html - 样式对象的内容/嵌入

reactjs - reactjs 应用程序中的全局 SASS 变量