Can I import an externally hosted file with sass?
Solution 1:
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);
Solution 2:
Sass will not compile any files from a remote location, all files must be accessible from the filesystem (local hard disk, shared network drive, mounted drive, etc.).
Sass also does not compile CSS files at all. https://github.com/nex3/sass/issues/556
@import "my.css";
Compiles to
@import "my.css";
Perhaps you might be interested in Compass extensions?
Solution 3:
You sure can. In this context, it works exactly as the standard CSS @import
rule. Just give it a URL to the CDN-hosted CSS file.
http://sass-lang.com/documentation/file.SASS_REFERENCE.html#import