middleman-livereload 3.4.3 → 3.4.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1ece19ba9427a4425ead19caeebdc025089a0859
4
- data.tar.gz: 8e820627aa497df57edecaf1b92c9e5c960eb147
3
+ metadata.gz: 17886dee2b4da416d13f35ac3347ca3fbb04354b
4
+ data.tar.gz: 6c80de20bd9283d6bc98e651b14098785400665d
5
5
  SHA512:
6
- metadata.gz: f05277bb6eb3b65054be15cc6f1735412a223252575f2648b871478ff8564ff7569da26a3d5040b3260267d35e64ee337f02a7004166cd8ce9c0f2255f73de39
7
- data.tar.gz: ce46f5b7287f3ca87240d1613ba21b36e0b628fd5dec114d1362df111c14d1a10d1a9dbdf6a23c06904e9284c028aa006870cf82b7b9f2fd3fa04ed05bd8b2e4
6
+ metadata.gz: d28b1acd59729a32d62dbe35f82caa9f70319e0d8e0317b273301701dee3552222ef1e3ad9d87110bb061e9bce66cfc74bafed1588703ce878169598843452c7
7
+ data.tar.gz: 4b510ae86724689d597e9b97cc96d337901ea574efe3bac705aef5294a1f85d1e2ee32f8db8bef1b6b53d6939b832c9b7e4bc7b07d49951fa47293490f36c562
data/README.md CHANGED
@@ -11,7 +11,7 @@ gem install middleman
11
11
  middleman init MY_PROJECT
12
12
  ```
13
13
 
14
- If you already have a Middleman project: Add `gem "middleman-livereload", "~> 3.3.0"` to your `Gemfile` and run `bundle install`
14
+ If you already have a Middleman project: Add `gem "middleman-livereload", "~> 3.4.3"` to your `Gemfile` and run `bundle install`
15
15
 
16
16
  ## Configuration
17
17
 
@@ -29,6 +29,10 @@ activate :livereload, apply_js_live: false
29
29
 
30
30
  Livereload's listener host/port, these options get passed to ::Rack::LiveReload middleware. Defaults:`'0.0.0.0'` and `'35729'`.
31
31
 
32
+ #### `:js_host` and `:js_port`
33
+
34
+ Similar to the `:host` and `:port` options, but allow you to specify a different host and port at the frontend Javascript level than at the backend EventMachine level. Useful when running behind a proxy or on a Docker VM. Defaults to `:host` and `:port`.
35
+
32
36
  #### `:apply_js_live` and `:apply_css_live`
33
37
 
34
38
  Whether live reload should attempt to reload javascript / css 'in-place', without complete reload of the page. Both default to `true`.
@@ -43,6 +47,16 @@ Disable Flash polyfil for browsers that support native WebSockets.
43
47
 
44
48
  Array of patterns for paths that must be ignored. These files will not be injected with the LiveReload script.
45
49
 
50
+ #### `:livereload_css_target`
51
+
52
+ CSS file to reload when detecting @imported partial was modified. Default `stylesheets/all.css`).
53
+ To opt out set `livereload_css_target: nil`.
54
+
55
+ #### `:livereload_css_pattern`
56
+
57
+ Regexp matching filenames that should trigger reload of :livereload_css_target when changed. Default: `Regexp.new('_.*\.css')`.
58
+
59
+
46
60
  ## Build & Dependency Status
47
61
 
48
62
  [![Gem Version](https://badge.fury.io/rb/middleman-livereload.png)][gem]
@@ -3,12 +3,16 @@ require 'middleman-livereload/reactor'
3
3
 
4
4
  module Middleman
5
5
  class LiveReloadExtension < Extension
6
- option :port, '35729', 'Port to bind the LiveReload API server to'
6
+ option :port, '35729', 'Port to bind the LiveReload API server to listen to'
7
7
  option :apply_js_live, true, 'Apply JS changes live, without reloading'
8
8
  option :apply_css_live, true, 'Apply CSS changes live, without reloading'
9
9
  option :no_swf, false, 'Disable Flash WebSocket polyfill for browsers that support native WebSockets'
10
10
  option :host, Socket.ip_address_list.find(->{ Addrinfo.ip 'localhost' }, &:ipv4_private?).ip_address, 'Host to bind LiveReload API server to'
11
11
  option :ignore, [], 'Array of patterns for paths that must be ignored'
12
+ option :js_port, nil, 'Port to connect the LiveReload Javascript to (if different than :port)'
13
+ option :js_host, nil, 'Host to connect LiveReload Javascript to (if different than :host)'
14
+ option :livereload_css_target, 'stylesheets/all.css', 'CSS file to load when a @imported CSS partials are modified'
15
+ option :livereload_css_pattern, Regexp.new('_.*\.css'), 'Regexp matching filenames that trigger live reloading target'
12
16
 
13
17
  def initialize(app, options_hash={}, &block)
14
18
  super
@@ -23,9 +27,13 @@ module Middleman
23
27
 
24
28
  port = options.port.to_i
25
29
  host = options.host
30
+ js_port = options.js_port || port
31
+ js_host = options.js_host || host
26
32
  no_swf = options.no_swf
27
33
  ignore = options.ignore
28
34
  options_hash = options.to_h
35
+ livereload_css_target = options.livereload_css_target
36
+ livereload_css_pattern = options.livereload_css_pattern
29
37
 
30
38
  app.ready do
31
39
  if @reactor
@@ -49,6 +57,13 @@ module Middleman
49
57
  end
50
58
  end
51
59
 
60
+ # handle imported partials
61
+ # load target file instead of triggering full page refresh
62
+ if livereload_css_pattern.match(file) and not livereload_css_target.nil?
63
+ logger.info("LiveReload: CSS import changed, reloading target")
64
+ reload_path = livereload_css_target
65
+ end
66
+
52
67
  @reactor.reload_browser(reload_path)
53
68
  end
54
69
 
@@ -62,7 +77,7 @@ module Middleman
62
77
 
63
78
  # Use the vendored livereload.js source rather than trying to get it from Middleman
64
79
  # https://github.com/johnbintz/rack-livereload#which-livereload-script-does-it-use
65
- use ::Rack::LiveReload, port: port, host: host, no_swf: no_swf, source: :vendored, ignore: ignore
80
+ use ::Rack::LiveReload, port: js_port, host: js_host, no_swf: no_swf, source: :vendored, ignore: ignore
66
81
  end
67
82
  end
68
83
  end
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  module LiveReload
3
- VERSION = "3.4.3"
3
+ VERSION = "3.4.4"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-livereload
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.3
4
+ version: 3.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Reynolds
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-07-24 00:00:00.000000000 Z
13
+ date: 2015-12-10 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: middleman-core
@@ -99,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
99
99
  version: '0'
100
100
  requirements: []
101
101
  rubyforge_project:
102
- rubygems_version: 2.4.6
102
+ rubygems_version: 2.4.8
103
103
  signing_key:
104
104
  specification_version: 4
105
105
  summary: LiveReload support for Middleman