4 ms·
I wasn't even aware @import existed, and I don't really see any redeeming reasons to use it instead of 'link' anyways, as 'link' is "cleaner" and is HTML and th
by nihilocrat 18y ago
I wasn't even aware @import existed, and I don't really see any redeeming reasons to use it instead of 'link' anyways, as 'link' is "cleaner" and is HTML and thus can reap all the rewards that linked javascript, image links, etc. enjoy. Can someone please explain?
- aristus 18y agoIt's just one of the many cosmic jokes of web programming. We have first-class functions, classes, DSLs, modules and mixins. Unfortunately these features are spread out over three separate languages: HTML/Javascript/CSS.
- eli 18y ago@imported stylesheets have high precedence over <link>ed ones. If you @import a stylesheet it's as if you typed it inline in the <style> block. AFAIK, that's the only functional difference
- deleted 18y ago[deleted]
- johns 18y agoYou can use @import inside an externally linked style sheet mimicking includes.
- boucher 18y agoThere's nothing "clean" about using a link. @import is an actually useful feature: the ability to define dependencies. "This file depends on another, which I've imported." Instead, using link tags forced you to push dependencies all the way to the top of every project (just like script tags). This is a huge failure of web technologies, and its one reason why all the good frameworks have to include build tools to flatten dependencies.