Skip to content

Instantly share code, notes, and snippets.

@antonioribeiro
Created November 9, 2019 19:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save antonioribeiro/fddc8a7accf23ae013a13000c78fbfd8 to your computer and use it in GitHub Desktop.
Save antonioribeiro/fddc8a7accf23ae013a13000c78fbfd8 to your computer and use it in GitHub Desktop.
// in your .env file, split APP_URL to extract protocol and hostname
APP_PROTOCOL=https
APP_HOSTNAME=myapp.test
APP_URL="${APP_PROTOCOL}://${APP_HOSTNAME}"
// install dotenv
npm install dotenv
// load it in your webpack.mix.js
require('dotenv').config()
// configure the LiveReload plugin to use the protocol && hostname you have on your .env file
new LiveReloadPlugin({
protocol: process.env.APP_PROTOCOL
hostname: process.env.APP_HOST
}),
// Change your template to use app.url instead
@if(app()->environment() === 'local')
<script src="{{ config('app.url') }}:35729/livereload.js"></script>
@endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment