Please sign in to comment.
Use readyState to trigger removal of old <link> [#198]
Previously we had a fixed 200ms delay before removing the old stylesheet on live CSS refresh. I'm not sure why it has been done that way. Problem is that Sprockets asset pipeline often takes more time to produce a CSS file, causing a flash of unstyled content for Rails developers. Waiting until readyState is 'complete' is clearly a superior way to detect when the new stylesheet has finished loading, and that's what this commit implements. Tested in Safari, Chrome, Firefox and Opera, and seems that it should work in IE too.
- Loading branch information...
Showing with 33 additions and 4 deletions.
|@@ -0,0 +1,4 @@|
|+ background: green;|
|+ background: red;|
|@@ -0,0 +1,10 @@|
|+ <title>LiveReload Test</title>|
|+ <link rel="stylesheet" href="http://localhost/~andreyvit/testcss.php">|
|+ <script src="../../../dist/livereload.js?host=localhost" async defer></script>|