1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-07-31 20:40:19 +02:00

Improve examples so that code changes propagate to browser (#527)

* Updated examples/dev.html so that the script would reload on a page refresh

* Made watch:examples verbose so we know when watchify has finished its work.
This commit is contained in:
Sunny Hirai
2016-12-16 18:19:48 -08:00
committed by Ian Storm Taylor
parent d3095145da
commit d56c0d8d95
2 changed files with 13 additions and 2 deletions

View File

@@ -8,6 +8,17 @@
</head> </head>
<body> <body>
<main></main> <main></main>
<script src="build.dev.js"></script> <script>
// Dynamically creates the script tag and adds the current time in ms
// as a query on the URL. This ensures the script is always reloaded.
//
// Useful during debugging because we want to see changes to the
// JavaScript code immediately.
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'build.dev.js?' + new Date().getTime();
head.appendChild(script);
</script>
</body> </body>
</html> </html>

View File

@@ -103,7 +103,7 @@
"tests": "mocha --compilers js:babel-core/register ./test/index.js", "tests": "mocha --compilers js:babel-core/register ./test/index.js",
"watch": "npm-run-all --parallel --print-label watch:lib watch:examples start", "watch": "npm-run-all --parallel --print-label watch:lib watch:examples start",
"watch:lib": "babel --watch --out-dir ./lib ./src", "watch:lib": "babel --watch --out-dir ./lib ./src",
"watch:examples": "watchify --debug --transform babelify ./examples/index.js -o ./examples/build.dev.js" "watch:examples": "watchify --debug --transform babelify ./examples/index.js -o ./examples/build.dev.js -v"
}, },
"browserify-global-shim": { "browserify-global-shim": {
"immutable": "Immutable", "immutable": "Immutable",