Skip to content

Commit 7b3bd9a

Browse files
committed
Switch livereload to browsersync
1 parent 3ff82cd commit 7b3bd9a

File tree

4 files changed

+19
-15
lines changed

4 files changed

+19
-15
lines changed

gulpfile.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
const elixir = require('laravel-elixir');
22

33
require('laravel-elixir-vue-2');
4-
require('laravel-elixir-livereload');
54

65
/*
76
|--------------------------------------------------------------------------
@@ -17,5 +16,8 @@ require('laravel-elixir-livereload');
1716
elixir(mix => {
1817
mix.sass('app.scss')
1918
.webpack('app.js');
20-
mix.livereload();
19+
mix.browserSync({
20+
proxy: 'web:8000',
21+
open: false
22+
});
2123
});

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,20 @@
55
"dev": "gulp watch"
66
},
77
"devDependencies": {
8+
"babel": "^6.5.2",
9+
"babel-loader": "^6.2.9",
10+
"babel-plugin-syntax-jsx": "^6.18.0",
11+
"babel-preset-es2015": "^6.18.0",
812
"bootstrap-sass": "^3.3.7",
913
"gulp": "^3.9.1",
1014
"jquery": "^3.1.0",
1115
"laravel-elixir": "^6.0.0-9",
1216
"laravel-elixir-vue-2": "^0.2.0",
1317
"laravel-elixir-webpack-official": "^1.0.2",
14-
"laravel-elixir-livereload": "^1.0",
18+
"laravel-elixir-browsersync-official": "^1.0.0",
1519
"lodash": "^4.16.2",
1620
"vue": "^2.0.1",
21+
"vue-template-compiler": "^2.1.4",
1722
"vue-resource": "^1.0.3"
1823
},
1924
"dependencies": {

readme.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,23 @@ Make sure to chown all the data in your webroot to your own user, since docker s
2222

2323
### Initial steps
2424

25-
> docker run --name myproject -it -d -v $(pwd):/app -w /app -p 8000:8000 verwilst/php7-cli php artisan serve --host=0.0.0.0
25+
> docker run --name myproject -it -d -v $(pwd):/app -w /app verwilst/php7-cli php artisan serve --host=0.0.0.0
2626
2727

28-
The project is configured to support live reloading. The browser opens a websocket to port 35729, so make sure it's accessible. This also compiles app.css and app.js under public/{css,js}:
28+
The project is configured with Browsersync. Gulp watch creates a proxy that points to our myproject container, so we need to link to it.
29+
This also compiles app.css and app.js under public/{css,js}:
2930

30-
> docker run --name myproject-gulp -it -d -v $(pwd):/app -p 35729:35729 -w /app verwilst/gulp watch
31+
> docker run --name myproject-gulp -it -d -v $(pwd):/app --link myproject:web -p 3000:3000 -w /app verwilst/gulp watch
32+
33+
The proxy listens on port 3000.
3134

3235
### Starting an existing app
3336

3437
> docker start mongo percona myproject myproject-gulp
3538
3639
( Leaving off mongo and/or percona if you didn't create those docker containers ofcourse. )
3740

38-
You can now open your browser on http://127.0.0.1:8000 .
41+
You can now open your browser on http://127.0.0.1:3000 .
3942

4043
## When MongoDB is needed
4144

resources/views/index.blade.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<meta name="viewport" content="width=device-width, initial-scale=1">
77
<meta name="csrf-token" content="{{ csrf_token() }}">
88

9-
<title>Laravel/Vue.js</title>
9+
<title>Laravel5/Vue.js2</title>
1010

1111
<!-- Fonts -->
1212
<link href="https://fonts.googleapis.com/css?family=Raleway:100,600" rel="stylesheet" type="text/css">
@@ -23,12 +23,6 @@
2323
</script>
2424

2525
<script src="/js/app.js"></script>
26-
27-
@if ( Config::get('app.debug') )
28-
<script type="text/javascript">
29-
document.write('<script src="//localhost:35729/livereload.js?snipver=1" type="text/javascript"><\/script>')
30-
</script>
31-
@endif
32-
26+
3327
</body>
3428
</html>

0 commit comments

Comments
 (0)