我可以使用sass导入外部托管的文件吗? [英] Can I import an externally hosted file with sass?

查看:89
本文介绍了我可以使用sass导入外部托管的文件吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Sass(SCSS)/指南针,是否可以从外部托管文件将一些CSS / SCSS导入代码中?

Using Sass (SCSS) / Compass, is it possible to import some CSS/SCSS into your code from an externally hosted file?

我托管了一个jQuery插件在CDN上,并希望将CSS保留在同一位置,这样我就不会丢失它。但是,我还希望能够将CSS拉入我的代码并在主CSS中进行编译,而不是在HTML中拉入一个额外的CSS文件。

I am hosting a jQuery plugin on a CDN and want to keep the CSS in the same location so I don't lose it. However, I'd also like to have the option to be able to pull the CSS into my code and have it compile within my main CSS rather than pulling in an extra CSS file in my HTML. Is this possible?

推荐答案

对于那些来这里的人来说,他们正在寻找一种导入CDN作为Sass的方法 @import 我在这里找到了答案: https ://github.com/webpack-contrib/sass-loader/issues/246

For those of you who came here looking for a way of importing a CDN as a sass @import I found the answer here: https://github.com/webpack-contrib/sass-loader/issues/246

这是您的操作方法(以引导程序为例) :

This is how you do it (using bootstrap as an example):

styles.scss

@import url("https://maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap.min.css");

这篇关于我可以使用sass导入外部托管的文件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆