view_inspect 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.markdown +8 -10
- data/lib/view_inspect/client_side_template.rb +1 -0
- data/lib/view_inspect/rails/middleware.rb +1 -1
- data/lib/view_inspect/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
M2Q3MjU0ZjEzNWIzYzkwYmJjZTk1NWMzYTA1NGExYzJhMzcxOGU0Ng==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MWQxODEyZDc3ZjNiNWJiNWFkNWJiYmVkMzVhM2E2MGY1NDQyOTE5Yg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OTc4ZTE5OTcwNmU4ZTliMjdiOTA5ZTQ0ZjcwMzM5NzllMDc1ZGI2YjllMDk0
|
10
|
+
YzhlMGFjMjI3MjkwMWY0ODgzNmI4N2EyY2YyZDk4YTM2NmUwNzc2YWIxMmYy
|
11
|
+
MjllODE3NzNmODdkNmI3ZDIwN2Y1ZTBiNTNjOTVlYjEzN2I2OTg=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MTBkNjNjOTg4OGQ3ZTdlMDMwZTY4ZjlmY2QxY2IwZDE4YjgyYjExODYwYWMx
|
14
|
+
YzkxOWY3YjJkMDdlMjU2MWVhMTk2NWFhMWJkMzUyZWU1NDY0NTZlNDYzZWQw
|
15
|
+
OTZmY2ZjZjIwMWM4NmFlYzViYjNiMWE5NmUzODFmNDMxZWIwOTA=
|
data/README.markdown
CHANGED
@@ -5,16 +5,17 @@ View Inspect tells you which server-side or client-side template is responsible
|
|
5
5
|
|
6
6
|
Source location is added by first stubbing out all template specific expressions (i.e. `<% %>` for erb). Nokogiri parses the resulting valid HTML fragment and adds file:line information to each DOM node. After which stubs are replaced back with original template expressions.
|
7
7
|
|
8
|
-
|
8
|
+
Demo
|
9
9
|
----
|
10
|
-
|
11
|
-
[
|
10
|
+
- [Diaspora: Haml + Backbone.js](https://i.imgur.com/bhK6lap.png)
|
11
|
+
- [Discourse: ERB + Ember.js + Handlebars](http://i.imgur.com/mD7sQ2m.png)
|
12
12
|
|
13
13
|
Support
|
14
14
|
----
|
15
15
|
| Template | Required Library |
|
16
16
|
| ----------------------- | ---------------------- |
|
17
17
|
| Haml | haml |
|
18
|
+
| Slim | slim |
|
18
19
|
| ERB | any erb implementation |
|
19
20
|
| Handlebars | ember-rails |
|
20
21
|
| EJS | sprockets |
|
@@ -28,7 +29,10 @@ Installation
|
|
28
29
|
gem "view_inspect"
|
29
30
|
end
|
30
31
|
|
31
|
-
|
32
|
+
Warning
|
33
|
+
----
|
34
|
+
|
35
|
+
By default, this is only enabled for development to avoid exposing source code filepath information publicly. If you want to disable it in development (i.e you want to benchmark/profile your app), add this line on config/environments/development.rb
|
32
36
|
|
33
37
|
ViewInspect.disable = true
|
34
38
|
|
@@ -63,12 +67,6 @@ Also, depending which library you're using, you may need to specify external lib
|
|
63
67
|
The reason why you may need to do this is because of the way we track the javascript file:line. We intercept the native DOM insertion methods such as appendChild, insertBefore, or replaceChild, look at the stacktrace, and then go through it to find the most recent caller which corresponds to our javascript code.
|
64
68
|
|
65
69
|
|
66
|
-
Warning
|
67
|
-
----
|
68
|
-
|
69
|
-
By default, this is only enabled for development to avoid exposing source code filepath information publicly.
|
70
|
-
|
71
|
-
|
72
70
|
|
73
71
|
Copyright
|
74
72
|
----
|
@@ -24,6 +24,7 @@ module ViewInspect
|
|
24
24
|
def self.class_handler_map
|
25
25
|
hash = {}
|
26
26
|
hash[::Ember::Handlebars::Template] = Handlers::Handlebars if defined? ::Ember::Handlebars::Template
|
27
|
+
hash[::HandlebarsAssets::TiltHandlebars] = Handlers::Handlebars if defined? ::HandlebarsAssets::TiltHandlebars
|
27
28
|
hash[::Sprockets::EjsTemplate] = Handlers::EJS if defined? ::Sprockets::EjsTemplate
|
28
29
|
hash[::Sprockets::EcoTemplate] = Handlers::Eco if defined? ::Sprockets::EcoTemplate
|
29
30
|
hash
|
@@ -10,7 +10,7 @@ module ViewInspect
|
|
10
10
|
def call(env)
|
11
11
|
status, headers, response = @app.call(env)
|
12
12
|
|
13
|
-
if headers["Content-Type"] =~ HTML_CONTENT_TYPE_REGEXP && response.
|
13
|
+
if headers["Content-Type"] =~ HTML_CONTENT_TYPE_REGEXP && response.each.to_a.join("") =~ HEAD_REGEXP
|
14
14
|
body = insert_view_inspect_script(response.body)
|
15
15
|
headers["Content-Length"] = body.length.to_s
|
16
16
|
response = [body]
|
data/lib/view_inspect/version.rb
CHANGED