Tilde用飞镖Sass CLI进口
我正在升级一个旧的系统,其中包括许多:
@import "~bootstrap/scss/mixins";
使用飞镖sass cli编译时失败。
我曾经使用node-sass,以及node-sass-tilde-importer
和node-sass-sass-package-importer
之类的软件包来帮助该语法。他们似乎不适用于飞镖。
鉴于我现在正在使用 dart sass cli,我该如何处理?
I'm upgrading an old system with many of these:
@import "~bootstrap/scss/mixins";
That fails when compiling with the dart-sass CLI.
I used to use node-sass, and packages like node-sass-tilde-importer
and node-sass-package-importer
to help with that syntax. They don't seem to work for dart-sass.
Given that I'm now using the dart sass CLI, how do I deal with this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
该解决方案很简单,但不幸的是不支持Tilde语法。
SCSS文件应该具有以下操作:
CLI语法是:
为了完整,显而易见的其他解决方案是:
The solution is simple, but unfortunately does not support the tilde syntax.
The scss file should have this:
And the cli syntax is:
For completeness, the obvious other solution is:
Dart Sass CLI?我认为在Dart Sass中无法进行这样的进口。您必须手动进行。
但是有一个SASS迁移器可以修复遗产SASS代码,请尝试一下:
https:// https:// sass -lang.com/documentation/cli/migrator
如果您将其与模块包装串一起使用,这可能会有所帮助:
如何使用webpack,sass-loader和dart sass tilde prefix导入sass
Dart Sass CLI? I think there is no way to import like this in Dart Sass. You have to do it manually.
But there is a Sass migrator to fix legacy sass code, give it a try :
https://sass-lang.com/documentation/cli/migrator
If you are using it with module bundlers, this might help:
How to import sass using tilde prefix with webpack, sass-loader and dart sass