view_inspect 0.3.7 → 0.3.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.markdown +7 -5
- data/lib/view_inspect/version.rb +1 -1
- data/lib/view_inspect.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NDRmZTg4YmJjMGQ4ZTdkM2Q4ZjYxNjcxZWVjNDg1MzI4Yzc2YjRiNQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YmE4MTlmMDc1MWYwY2Q2OTE0YmIxMjgzODIxODI0NGI1YTNhZDIxMw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZTI5OWZlZDM5ODY2NzlkMzQwYWQ2NzVlMDBjNjE5MzRiZjRjYTk2ZDdlMGVm
|
10
|
+
MWIzOGM3MGYzNzE0NjUxZjkyYzc5MTYzZWYwYWVmMTQxYWZkZjQyN2ExMjJm
|
11
|
+
ZmZlMDVlNTA1ZDM4YWM1ZTRkZjE4ZjYzNWI3MWRiNDFjNGQyMmM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZmZhYzJmZDkyZWU2NjlhZGIwNDg3YjUzZTk4ZDFmNjI3MmEwNDllNTNmZjk1
|
14
|
+
MTBhMTMzN2ZmY2NmNzZhYmI4ZWI5ZGRiNWZlNmI0MTEyNjIyMTUzYWRlOTE5
|
15
|
+
MDZiMmEzNDFmYTM0Y2Q1NmY0MzJlNTQxNjA0M2RlODk5NmNhNGM=
|
data/README.markdown
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
View Inspect
|
2
2
|
============
|
3
3
|
|
4
|
-
View Inspect
|
4
|
+
View Inspect shows you the exact file and line number of the server-side or client-side template that's responsible for rendering a DOM element. Instead of using grep to filter through a large codebase, the source location can be found right away in its data-attribute when you open up web inspector. Works with Rails 3 and 4. See below for templates supported and their required libraries.
|
5
5
|
|
6
6
|
Demo
|
7
7
|
----
|
@@ -38,7 +38,7 @@ By default, this is only enabled for development to avoid exposing source code f
|
|
38
38
|
How it Works
|
39
39
|
----
|
40
40
|
|
41
|
-
Except for Haml and Slim where the compiler/parser is monkeypatched
|
41
|
+
Except for Haml and Slim where the compiler/parser is monkeypatched, view templates are augmented with source location metadata by preprocessing them with an HTML parser. Basically, we first stub out all template specific expressions (i.e. `<% %>` for erb) from a template file. Then, we use the Nokogiri HTML Parser to parse the resulting valid HTML fragment, and add file:line information to its child nodes. Once this is done, we bring back our original template expressions and remove the stubs. A little bit hacky but it works.
|
42
42
|
|
43
43
|
|
44
44
|
Server-Side Templates
|
@@ -55,11 +55,13 @@ For client-side templates to work, they have to live in separate files as oppose
|
|
55
55
|
|
56
56
|
HTML Syntax Errors
|
57
57
|
----
|
58
|
-
ViewInspect depends on Nokogiri to preprocess a template and add file:line information to each node. If there's any invalid HTML in your file, Nokogiri would delete it, and sometimes your HTML would look different in the browser because of this.
|
58
|
+
ViewInspect depends on Nokogiri to preprocess a template and add file:line information to each node. If there's any invalid HTML in your file, Nokogiri would delete it, and sometimes your HTML would look different in the browser because of this.
|
59
59
|
|
60
|
-
|
60
|
+
If such errors exist, view_inspect would simply return the original file template without the source location metadata to avoid malformed html.
|
61
61
|
|
62
|
-
|
62
|
+
An alternative solution is to show a warning message to the user detailing where the HTML syntax errors are located so that the user can remove it. To enable this, you can set it by adding this line to config/environments/development.rb
|
63
|
+
|
64
|
+
ViewInspect.show_html_syntax_error = true
|
63
65
|
|
64
66
|
Copyright
|
65
67
|
----
|
data/lib/view_inspect/version.rb
CHANGED
data/lib/view_inspect.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: view_inspect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Reginald Tan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|