Closed rizkysyazuli closed 13 years ago
LiveReload currently does not support @import
. CSSOM provides CSSImportRule#href, so I think I can fix it.
awesome.. looking forward for the next release :)
I was not completely accurate. LiveReload supports @import in CSS files, it does not support @import in <style>
.
index.html
<link rel="stylesheet" href="main.css">
main.css
@import "slave.css"; html {background: red}
slave.css
body {background: green}
When you change slave.css changes should be applied. Everything should work well.
However, this one won't work:
index.html
<style>@import "slave.css";<style>
I don't see any reason to put @import
into <style>
, so I won't fix it.
LiveReload does not support @import in a sense that it will do a full page reload when slave.css is changed in your example, since it uses document.getElementsByTagName("link")
to find stylesheets.
Any good ideas on how to handle @import's, aside from doing XMLHTTPRequest on every stylesheet and running a regexp?
http://github.com/NV/livereload/commit/f185861d59e7b4881785149d3acdf3165d7def22 No XHRs, no regexps. Try it.
test/index.html
test/slave.css
LR will try to reload test/main.css
. It'll work well. However, test/slave.css
won't be reloaded because it's cached. I can't bust the cache, because I can't append ?livereload=
to imported stylesheet.
I've got something working http://github.com/NV/livereload/commit/1ba2a52f174d54e1bd06f52b8cd2d3c6b10323e6
Wow! NV, you're awesome. I guess we should bake a new version on weekend.
hell yea!
LiveReload does not support @import in a sense that it will do a full page reload when slave.css is changed in your example ...
Instead of full page reload we could reload all stylesheets. http://github.com/NV/livereload/commit/0b4d1fd79ca7708ccaf5454160a834e50da96af1
Reload just imported stylesheet is a bit more complicated. I'll do it later.
Support for CSS files included with @import. Closed by c65e295772bf91292c52253a3e3de0f344c1a7f1, #35.
i have a few css files linked to the master stylesheet via @import method. after a few editing i realized the live reload doesn't run. the page does get refreshed by the extension, but without the live reload thing.. i hope you understand what i mean :P
i'm working with SASS files and developing on Safari 5.0.2 (OSX 10.6.4)