widget_builder 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/widget_builder.rb +2 -11
- data/lib/widget_builder/version.rb +1 -1
- data/widget_builder.gemspec +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a6f4b7ecb9367eb1279d30d8710aa83cbb7e62c
|
4
|
+
data.tar.gz: 708b4d461ad3fe3d1cb1e8d3ef63e8a72e1f6b95
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 276ade3639038279c3b62d912b7c50c461bf1152dd78509d25042084e4dbce9121a04f246bd2501057163883caad3807d4c509f55fc4c437fa892632cacbe61b
|
7
|
+
data.tar.gz: 93506c5add647e58b6831954b3b78c9cc7d0cca275bd45988e90c96d67751f34087ef566871412b85acf4a2be777f9ab00f57d952c893a61a921c54b6f709997
|
data/lib/widget_builder.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'widget_builder/constants'
|
2
2
|
require 'awesome_print'
|
3
3
|
require 'yui/compressor'
|
4
|
+
require 'html_uglifier'
|
4
5
|
require 'premailer'
|
5
6
|
require 'sass'
|
6
7
|
require 'find'
|
@@ -62,7 +63,7 @@ module WidgetBuilder
|
|
62
63
|
html_with_css = premailer.to_inline_css # places all the css inline with the html code
|
63
64
|
html_with_css = WidgetBuilder.remove_excess_premailer_content(html_with_css) # cleans up excess styles
|
64
65
|
if @compress == true
|
65
|
-
|
66
|
+
HtmlUglifier::Compressor.new.compress(html_with_css).gsub(/\n/, '')
|
66
67
|
else
|
67
68
|
html_with_css.gsub("\n", " \\\n") # returns the html as is but adds trailing backslashes after each line to allow the multiline string in JavaScript
|
68
69
|
end
|
@@ -198,15 +199,5 @@ puts %Q{<a class="#{@widget_name}" href="#{@href}"></a>
|
|
198
199
|
html = html.gsub(/\s*line-height:\s*normal\s*;\s*/, '')
|
199
200
|
html = html.gsub(/\s*font-weight:\s*normal\s*;\s*/, '')
|
200
201
|
end
|
201
|
-
|
202
|
-
# removes html comments and unnecessary spaces
|
203
|
-
def self.html_uglifier(html)
|
204
|
-
html = html.gsub(/<!--.*?-->/m, '') # remove html comments
|
205
|
-
html = html.gsub(/[\n\r\t]/m, '') # remove new lines, line returns, and tabs
|
206
|
-
html = html.gsub(/>\s+?</m, '><') # remove excess whitespace between tags
|
207
|
-
html = html.gsub(/\s+?/m, ' ') # remove excess whitespace between elements
|
208
|
-
html = html.gsub(/<\s+?/m, '<') # remove excess whitespace after <
|
209
|
-
html = html.gsub(/\s+?>/m, '>') # remove excess whitespace before >
|
210
|
-
end
|
211
202
|
end
|
212
203
|
|
data/widget_builder.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: widget_builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Endri Gjiri
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-07-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - '>='
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: html_uglifier
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 0.1.3
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 0.1.3
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: premailer
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|