diff --git a/assets/public/js/browsersync.js b/assets/public/js/browsersync.js new file mode 100644 index 0000000..d3bfb9c --- /dev/null +++ b/assets/public/js/browsersync.js @@ -0,0 +1,15 @@ +(function() { + try { + var script = document.createElement('script'); + if ('async') { + script.async = true; + } + // script.src = 'http://HOST:3002/browser-sync/browser-sync-client.js?v=2.29.0'.replace("HOST", location.hostname); + script.src = 'http://localhost:3002/browser-sync/browser-sync-client.js?v=2.29.0'; + if (document.body) { + document.body.appendChild(script); + } + } catch (e) { + console.error("Browsersync: could not append script tag", e); + } +})() diff --git a/templates/browsersync.tmpl b/templates/browsersync.tmpl index 166b13b..0cd9643 100644 --- a/templates/browsersync.tmpl +++ b/templates/browsersync.tmpl @@ -1,18 +1 @@ - - - + diff --git a/templates/footer.tmpl b/templates/footer.tmpl index dc6d4d0..dcfd3d0 100644 --- a/templates/footer.tmpl +++ b/templates/footer.tmpl @@ -15,8 +15,5 @@ -{{- if .DevelMode -}} -{{ template "browsersync.tmpl" }} -{{- end }} diff --git a/templates/head.tmpl b/templates/head.tmpl index 46d5a97..3a0be69 100644 --- a/templates/head.tmpl +++ b/templates/head.tmpl @@ -18,10 +18,14 @@ - - + + {{- if .DevelMode -}} - + + +{{ template "browsersync.tmpl" }} +{{ else }} + {{- end -}}