Skip to content

Instantly share code, notes, and snippets.

@frullah
Last active March 27, 2020 18:19
Show Gist options
  • Save frullah/eff3e969fdfc66dc535098a9d40b0b9f to your computer and use it in GitHub Desktop.
Save frullah/eff3e969fdfc66dc535098a9d40b0b9f to your computer and use it in GitHub Desktop.
static file browser-sync
  1. Run browser-sync -w\
  2. Access the file from file query parameter instead of in path
    e.g
    use http://localhost:3000?file=index.css
    instead of http://localhost:3000/index.css
<body style="height: 100vh; margin: 0;">
<iframe id="iframe" frameborder="0" width="100%" height="100%"></iframe>
<script>
var file = new URLSearchParams(location.search).get('file')
document.getElementById('iframe').src = file
</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment