├── .editorconfig ├── .gitattributes ├── .gitignore ├── .jshintrc ├── LICENSE ├── README.md ├── index.js └── package.json /.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = tab 6 | indent_size = 4 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | [*.md] 13 | trim_trailing_whitespace = false 14 | 15 | [test/fixtures/*] 16 | insert_final_newline = false 17 | trim_trailing_whitespace = false 18 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | temp/ 4 | coverage 5 | -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "node": true, 3 | "esnext": true, 4 | "bitwise": true, 5 | "camelcase": true, 6 | "curly": true, 7 | "eqeqeq": true, 8 | "immed": true, 9 | "indent": 4, 10 | "latedef": true, 11 | "newcap": true, 12 | "noarg": true, 13 | "quotmark": "double", 14 | "regexp": true, 15 | "undef": true, 16 | "unused": true, 17 | "strict": true, 18 | "trailing": true, 19 | "smarttabs": true, 20 | "white": true 21 | } 22 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Joseph Richardson 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # laravel-elixir-livereload 2 | > laravel-elixir-livereload plugin for [larvel-elixir](https://github.com/laravel/elixir) and [gulp](https://github.com/wearefractal/gulp) 3 | 4 | [![npm](https://img.shields.io/npm/v/laravel-elixir-livereload.svg)](https://www.npmjs.com/package/laravel-elixir-livereload) 5 | [![npm](https://img.shields.io/npm/dm/laravel-elixir-livereload.svg)](https://www.npmjs.com/package/laravel-elixir-livereload) 6 | [![GitHub issues](https://img.shields.io/github/issues/EHLOVader/laravel-elixir-livereload.svg)](https://github.com/EHLOVader/laravel-elixir-livereload/issues) 7 | [![GitHub stars](https://img.shields.io/github/stars/EHLOVader/laravel-elixir-livereload.svg)](https://github.com/EHLOVader/laravel-elixir-livereload/stargazers) 8 | [![GitHub forks](https://img.shields.io/github/forks/EHLOVader/laravel-elixir-livereload.svg)](https://github.com/EHLOVader/laravel-elixir-livereload/network) 9 | [![GitHub license](https://img.shields.io/github/license/ehlovader/laravel-elixir-livereload.svg)](https://github.com/ehlovader/laravel-elixir-livereload) 10 | 11 | ## Installation 12 | 13 | Using NPM to install Laravel Elixir Livereload and save your `packages.json` 14 | 15 | **For laravel-elixir >v3.x** 16 | ``` 17 | npm install --save-dev laravel-elixir-livereload 18 | ``` 19 | 20 | **For laravel-elixir < v2.x** 21 | ``` 22 | npm install --save-dev laravel-elixir-livereload@"^0.0" 23 | ``` 24 | 25 | Or you can manually update your `packages.json` to include Laravel Elixir Livereload 26 | 27 | ``` 28 | { 29 | "devDependencies": { 30 | "gulp": "^3.8.8", 31 | "laravel-elixir": "^3.0", 32 | "laravel-elixir-livereload": "^1.0" 33 | } 34 | } 35 | ``` 36 | 37 | and then run `npm install` 38 | 39 | Next, add it to your Elixir-enhanced Gulpfile, like so: 40 | 41 | ```js 42 | var elixir = require('laravel-elixir'); 43 | 44 | require('laravel-elixir-livereload'); 45 | 46 | elixir(function(mix) { 47 | mix.livereload(); 48 | }); 49 | ``` 50 | 51 | Live reload also uses a script file so add the following to your blade templates. 52 | 53 | ```php 54 | @if ( Config::get('app.debug') ) 55 | 58 | @endif 59 | ``` 60 | 61 | That's it! You're all set to go! 62 | 63 | ## Usage 64 | 65 | 66 | ## API 67 | 68 | You can change the src glob used for the stream or pass options to the `livereload` task to customize behavior. 69 | 70 | ### laravel-elixir-livereload(src, options) 71 | 72 | #### src _(optional)_ 73 | Type: `array` or `string` 74 | Default: `[ 75 | 'app/**/*', 76 | 'public/**/*', 77 | 'resources/views/**/*' 78 | ]` 79 | 80 | #### options _(optional)_ 81 | Type: `object` 82 | 83 | Default: `{}` 84 | 85 | ###livereload options 86 | larvel-elixir-livereload passes its options on to [livereload](https://github.com/vohof/gulp-livereload). 87 | 88 | ``` 89 | port Server port 90 | host Server host 91 | basePath Path to prepend all given paths 92 | start Automatically start 93 | quiet false Disable console logging 94 | reloadPage index.html Path to the page the browsers on for a full page reload 95 | ``` 96 | 97 | ###tiny-lr options 98 | livereload also passes its options through to the [tiny-lr](https://github.com/mklabs/tiny-lr) server. 99 | 100 | ``` 101 | livereload Path to the client side lib (defaults to path.join(__dirname, '../node_modules/livereload-js/dist/livereload.js')) 102 | port Livereload port (defaults to 35729) 103 | errorListener A callback to invoke when an error occurs (otherwise, fallbacks to standard error output) 104 | app An express or other middleware based HTTP server 105 | key Option to pass in to create an https server 106 | cert Option to pass in to create an https server 107 | pfx Can also be used to create an https server instead of key & cert 108 | liveCSS LiveReload option to enable live CSS reloading (defaults to true) 109 | liveJs LiveReload option to enable live JS reloading (defaults to true) 110 | liveImg LiveReload option to enable live images reloading (defaults to true) 111 | ``` 112 | 113 | ## License 114 | 115 | [The MIT License (MIT)](http://en.wikipedia.org/wiki/MIT_License) 116 | 117 | Copyright (c) 2015 Joseph Richardson 118 | 119 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 120 | 121 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 122 | 123 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 124 | 125 | 126 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | var gulp = require('gulp'), 2 | Elixir = require('laravel-elixir'), 3 | livereload = require('gulp-livereload'), 4 | config = Elixir.config; 5 | 6 | 7 | Elixir.extend('livereload', function (src, options) { 8 | 9 | defaultSrc = [ 10 | config.appPath + '/**/*', 11 | config.publicPath + '/**/*', 12 | 'resources/views/**/*', 13 | '!**/*.map' 14 | ]; 15 | 16 | src = src || defaultSrc; 17 | 18 | gulp.on('task_start', function (e) { 19 | if (e.task === 'watch') { 20 | gulp.watch(src) 21 | .on('change', function (event) { 22 | livereload.changed(event.path); 23 | }); 24 | 25 | livereload.listen(options); 26 | } 27 | }); 28 | 29 | }); 30 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "laravel-elixir-livereload", 3 | "version": "1.1.6", 4 | "description": "An elixir wrapper for livereload", 5 | "keywords": [ 6 | "laravel", 7 | "elixir", 8 | "livereload", 9 | "gulp" 10 | ], 11 | "author": { 12 | "name": "Joseph Richardson", 13 | "email": "j4h.r8n@gmail.com", 14 | "url": "https://github.com/EHLOVader" 15 | }, 16 | "repository": { 17 | "type": "git", 18 | "url": "https://github.com/ehlovader/laravel-elixir-livereload" 19 | }, 20 | "bugs": { 21 | "url": "https://github.com/ehlovader/laravel-elixir-livereload/issues" 22 | }, 23 | "homepage": "https://github.com/ehlovader/laravel-elixir-livereload", 24 | "main": "index.js", 25 | "scripts": { 26 | "test": "echo \"Error: no test specified\" && exit 1" 27 | }, 28 | "dependencies": { 29 | "gulp": "^3.8.8", 30 | "gulp-livereload": "^3.8.0", 31 | "gulp-util": "~2.2.0" 32 | }, 33 | "peerDependencies": { 34 | "laravel-elixir": "^5.0" 35 | }, 36 | "engines": { 37 | "node": ">=0.8.0", 38 | "npm": ">=1.2.10" 39 | }, 40 | "license": "MIT" 41 | } 42 | --------------------------------------------------------------------------------