1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-21 06:31:28 +02:00

Reloading the page now also reloads the CSS. (#532)

This commit is contained in:
Sunny Hirai
2016-12-25 21:18:16 -08:00
committed by Ian Storm Taylor
parent 5cf11f7df4
commit dbef33a58f

View File

@@ -4,21 +4,26 @@
<title>Slate</title> <title>Slate</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons"> <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:400,400i,700,700i&subset=latin-ext" > <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:400,400i,700,700i&subset=latin-ext" >
<link rel="stylesheet" href="index.css">
</head> </head>
<body> <body>
<main></main> <main></main>
<script> <script>
// Dynamically creates the script tag and adds the current time in ms // Dynamically creates the script and link tag and adds the current time
// as a query on the URL. This ensures the script is always reloaded. // in ms as a query on the URL. This ensures the script and the link is
// always reloaded.
// //
// Useful during debugging because we want to see changes to the // Useful during debugging because we want to see changes to the
// JavaScript code immediately. // JavaScript and CSS code immediately.
var head = document.getElementsByTagName('head')[0]; var head = document.getElementsByTagName('head')[0]
var script = document.createElement('script'); var script = document.createElement('script')
script.type = 'text/javascript'; var time = new Date().getTime()
script.src = 'build.dev.js?' + new Date().getTime(); script.type = 'text/javascript'
head.appendChild(script); script.src = 'build.dev.js?' + time
head.appendChild(script)
var link = document.createElement('link')
link.rel = 'stylesheet'
link.href = 'index.css?' + time
head.appendChild(link)
</script> </script>
</body> </body>
</html> </html>