bootstrap-email 1.0.0.alpha1 → 1.0.0.alpha3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/core/bootstrap-email.scss +2 -0
- data/core/bootstrap-head.scss +1 -1
- data/core/scss/_selectors_for_utils.scss +24 -0
- data/core/scss/_utilities.scss +24 -4
- data/core/scss/components/_grid.scss +12 -9
- data/core/scss/components/_stack.scss +33 -0
- data/core/scss/utilities/_sizing.scss +21 -2
- data/core/scss/utilities/_typography.scss +4 -10
- data/core/scss/utilities/_valign.scss +5 -0
- data/core/templates/body.html +9 -0
- data/core/templates/{container.html.erb → container.html} +4 -4
- data/core/templates/div.html +3 -0
- data/core/templates/table-left.html +9 -0
- data/core/templates/table-to-tbody.html +5 -0
- data/core/templates/table-to-tr.html +7 -0
- data/core/templates/table.html +9 -0
- data/core/templates/td.html +3 -0
- data/core/templates/tr.html +5 -0
- data/lib/{bootstrap_email.rb → bootstrap-email.rb} +6 -1
- data/lib/bootstrap-email/bootstrap_email_cli.rb +9 -9
- data/lib/bootstrap-email/compiler.rb +49 -65
- data/lib/bootstrap-email/config.rb +50 -0
- data/lib/bootstrap-email/{components → converters}/alert.rb +1 -1
- data/lib/bootstrap-email/converters/align.rb +22 -0
- data/lib/bootstrap-email/{components → converters}/badge.rb +1 -1
- data/lib/bootstrap-email/converters/base.rb +62 -0
- data/lib/bootstrap-email/converters/block.rb +13 -0
- data/lib/bootstrap-email/converters/body.rb +10 -0
- data/lib/bootstrap-email/{components → converters}/button.rb +1 -1
- data/lib/bootstrap-email/{components → converters}/card.rb +3 -3
- data/lib/bootstrap-email/{components → converters}/color.rb +1 -1
- data/lib/bootstrap-email/{components → converters}/container.rb +1 -1
- data/lib/bootstrap-email/converters/force_encoding.rb +16 -0
- data/lib/bootstrap-email/converters/grid.rb +14 -0
- data/lib/bootstrap-email/converters/head_style.rb +33 -0
- data/lib/bootstrap-email/{components → converters}/hr.rb +2 -2
- data/lib/bootstrap-email/{components → converters}/margin.rb +1 -1
- data/lib/bootstrap-email/{components → converters}/padding.rb +1 -1
- data/lib/bootstrap-email/converters/paragraph.rb +13 -0
- data/lib/bootstrap-email/converters/preview_text.rb +18 -0
- data/lib/bootstrap-email/{components → converters}/spacer.rb +1 -1
- data/lib/bootstrap-email/{components → converters}/spacing.rb +5 -6
- data/lib/bootstrap-email/converters/stack.rb +30 -0
- data/lib/bootstrap-email/{components → converters}/table.rb +1 -1
- data/lib/bootstrap-email/converters/version_comment.rb +15 -0
- data/lib/bootstrap-email/erb.rb +9 -0
- data/lib/bootstrap-email/rails/action_mailer.rb +7 -2
- data/lib/bootstrap-email/sass_cache.rb +43 -26
- data/lib/bootstrap-email/setup.rb +27 -0
- metadata +44 -31
- data/core/templates/body.html.erb +0 -9
- data/core/templates/col.html.erb +0 -3
- data/core/templates/div.html.erb +0 -3
- data/core/templates/row.html.erb +0 -7
- data/core/templates/table-left.html.erb +0 -9
- data/core/templates/table.html.erb +0 -9
- data/lib/bootstrap-email/components/align.rb +0 -21
- data/lib/bootstrap-email/components/base.rb +0 -26
- data/lib/bootstrap-email/components/body.rb +0 -22
- data/lib/bootstrap-email/components/grid.rb +0 -14
- data/lib/bootstrap-email/components/paragraph.rb +0 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f70b6dc2a2d0ebd4dfcdee53c7242e2aa6c7824571d41be81e0518e1516ce03c
|
4
|
+
data.tar.gz: c49e013fd55e2b2f87c204dc8b64ac093149e4d45df5e2d5da809540b2c4b399
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab6c6bff12d2787b5962c51ae97983abdd407ccdd77e72a24e62644ff8e16d5a83d33e32ec14e577c9514731038091340c66ba47fd09c645380fc2aab27d42a6
|
7
|
+
data.tar.gz: 74a21957509ea73128b3d13c89dd21e0b6084c1a90efdac8ef4e3238e29e7ad4c10581d480665eacb578dd78c1177d9494e932bb20b841a93960cfb4b1497f8b
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.0.
|
1
|
+
1.0.0.alpha3
|
data/core/bootstrap-email.scss
CHANGED
@@ -16,6 +16,7 @@
|
|
16
16
|
@import 'scss/components/image';
|
17
17
|
@import 'scss/components/preview';
|
18
18
|
@import 'scss/components/table';
|
19
|
+
@import 'scss/components/stack';
|
19
20
|
|
20
21
|
@import 'scss/utilities/background';
|
21
22
|
@import 'scss/utilities/border';
|
@@ -26,3 +27,4 @@
|
|
26
27
|
@import 'scss/utilities/spacing';
|
27
28
|
@import 'scss/utilities/text-decoration';
|
28
29
|
@import 'scss/utilities/typography';
|
30
|
+
@import 'scss/utilities/valign';
|
data/core/bootstrap-head.scss
CHANGED
@@ -98,3 +98,27 @@
|
|
98
98
|
}
|
99
99
|
}
|
100
100
|
}
|
101
|
+
|
102
|
+
//
|
103
|
+
// Text align
|
104
|
+
//
|
105
|
+
@mixin text-align-util($class) {
|
106
|
+
#{$class} {
|
107
|
+
&,
|
108
|
+
& > tbody > tr > td {
|
109
|
+
@content
|
110
|
+
}
|
111
|
+
}
|
112
|
+
}
|
113
|
+
|
114
|
+
//
|
115
|
+
// Vertical align
|
116
|
+
//
|
117
|
+
@mixin valign-util($class) {
|
118
|
+
#{$class} {
|
119
|
+
&,
|
120
|
+
& > tbody > tr > td {
|
121
|
+
@content
|
122
|
+
}
|
123
|
+
}
|
124
|
+
}
|
data/core/scss/_utilities.scss
CHANGED
@@ -117,9 +117,29 @@ $border-widths: (
|
|
117
117
|
) !default;
|
118
118
|
|
119
119
|
$border-radiuses: (
|
120
|
-
'
|
121
|
-
'':
|
122
|
-
'-
|
120
|
+
'': 4px,
|
121
|
+
'-none': 0px,
|
122
|
+
'-sm': 2px,
|
123
|
+
'-md': 6px,
|
124
|
+
'-lg': 8px,
|
123
125
|
'-xl': 12px,
|
124
|
-
'-
|
126
|
+
'-2xl': 16px,
|
127
|
+
'-3xl': 24px,
|
128
|
+
'-full': 9999px
|
129
|
+
) !default;
|
130
|
+
|
131
|
+
$vertical-align: (
|
132
|
+
top,
|
133
|
+
middle,
|
134
|
+
bottom,
|
135
|
+
baseline,
|
136
|
+
text-top,
|
137
|
+
text-bottom
|
138
|
+
) !default;
|
139
|
+
|
140
|
+
$text-align: (
|
141
|
+
left,
|
142
|
+
right,
|
143
|
+
center,
|
144
|
+
justify
|
125
145
|
) !default;
|
@@ -1,10 +1,13 @@
|
|
1
1
|
table.row {
|
2
2
|
table-layout: fixed;
|
3
|
+
-premailer-width: 100%;
|
3
4
|
width: 100%;
|
4
5
|
& > tbody > tr > td {
|
5
6
|
min-height: 1px;
|
6
7
|
font-weight: normal;
|
7
|
-
padding-right:
|
8
|
+
padding-right: 24px;
|
9
|
+
vertical-align: top;
|
10
|
+
text-align: left;
|
8
11
|
}
|
9
12
|
}
|
10
13
|
|
@@ -16,18 +19,18 @@ table.row {
|
|
16
19
|
}
|
17
20
|
|
18
21
|
@each $space, $value in $spacers {
|
19
|
-
table.row.
|
20
|
-
table.row.
|
21
|
-
table.row.
|
22
|
-
table.row.
|
22
|
+
table.row.gap-#{$space},
|
23
|
+
table.row.gap-x-#{$space},
|
24
|
+
table.row.gap-lg-#{$space},
|
25
|
+
table.row.gap-x-lg-#{$space} {
|
23
26
|
& > tbody > tr > td {
|
24
27
|
padding-right: $value;
|
25
28
|
}
|
26
29
|
}
|
27
|
-
table.row.
|
28
|
-
table.row.
|
29
|
-
table.row.
|
30
|
-
table.row.
|
30
|
+
table.row.gap-#{$space},
|
31
|
+
table.row.gap-y-#{$space},
|
32
|
+
table.row.gap-lg-#{$space},
|
33
|
+
table.row.gap-y-lg-#{$space} {
|
31
34
|
& > tbody > tr > td {
|
32
35
|
padding-bottom: $value;
|
33
36
|
}
|
@@ -0,0 +1,33 @@
|
|
1
|
+
@each $space, $value in $spacers {
|
2
|
+
table.stack-x.gap-#{$space} > tbody > tr > td {
|
3
|
+
padding-right: $value;
|
4
|
+
&:last-child {
|
5
|
+
padding-right: 0;
|
6
|
+
}
|
7
|
+
}
|
8
|
+
table.stack-y.gap-#{$space} > tbody > tr {
|
9
|
+
& > td {
|
10
|
+
padding-bottom: $value;
|
11
|
+
}
|
12
|
+
&:last-child > td {
|
13
|
+
padding-bottom: 0;
|
14
|
+
}
|
15
|
+
}
|
16
|
+
}
|
17
|
+
|
18
|
+
.stack-cell {
|
19
|
+
vertical-align: top;
|
20
|
+
text-align: left;
|
21
|
+
}
|
22
|
+
|
23
|
+
@each $align in $vertical-align {
|
24
|
+
table.stack-valign-#{$align} > tbody > tr > td {
|
25
|
+
vertical-align: $align;
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
@each $align in $text-align {
|
30
|
+
table.stack-align-#{$align} > tbody > tr > td {
|
31
|
+
text-align: $align;
|
32
|
+
}
|
33
|
+
}
|
@@ -1,12 +1,12 @@
|
|
1
1
|
@each $prefix in $breakpoints {
|
2
2
|
@each $name, $property in $sizing-types {
|
3
|
-
@include sizing-util('
|
3
|
+
@include sizing-util('.max-#{$name}-#{$prefix}full') {
|
4
4
|
max-#{$property}: 100%;
|
5
5
|
-premailer-#{$property}: 100%;
|
6
6
|
#{$property}: 100%;
|
7
7
|
}
|
8
8
|
@each $size, $value in $sizing {
|
9
|
-
@include sizing-util('
|
9
|
+
@include sizing-util('.max-#{$name}-#{$prefix}#{$size}') {
|
10
10
|
max-#{$property}: $value;
|
11
11
|
-premailer-#{$property}: strip-unit($value);
|
12
12
|
#{$property}: 100%;
|
@@ -14,3 +14,22 @@
|
|
14
14
|
}
|
15
15
|
}
|
16
16
|
}
|
17
|
+
|
18
|
+
@each $prefix in $breakpoints {
|
19
|
+
@each $name, $property in $sizing-types {
|
20
|
+
@include sizing-util('.#{$name}-#{$prefix}full') {
|
21
|
+
-premailer-#{$property}: 100%;
|
22
|
+
#{$property}: 100%;
|
23
|
+
}
|
24
|
+
@include sizing-util('.#{$name}-#{$prefix}auto') {
|
25
|
+
-premailer-#{$property}: auto;
|
26
|
+
#{$property}: auto;
|
27
|
+
}
|
28
|
+
@each $size, $value in $sizing {
|
29
|
+
@include sizing-util('.#{$name}-#{$prefix}#{$size}') {
|
30
|
+
-premailer-#{$property}: strip-unit($value);
|
31
|
+
#{$property}: $value;
|
32
|
+
}
|
33
|
+
}
|
34
|
+
}
|
35
|
+
}
|
@@ -36,16 +36,10 @@ h1, h2, h3, h4, h5, h6,
|
|
36
36
|
}
|
37
37
|
}
|
38
38
|
|
39
|
-
|
40
|
-
text-align
|
41
|
-
|
42
|
-
|
43
|
-
.text-right {
|
44
|
-
text-align: right !important;
|
45
|
-
}
|
46
|
-
|
47
|
-
.text-center {
|
48
|
-
text-align: center !important;
|
39
|
+
@each $align in $text-align {
|
40
|
+
@include text-align-util('.text-#{$align}') {
|
41
|
+
text-align: $align !important;
|
42
|
+
}
|
49
43
|
}
|
50
44
|
|
51
45
|
p {
|
@@ -1,18 +1,18 @@
|
|
1
|
-
<table class="
|
1
|
+
<table class="{{ classes }}" role="presentation">
|
2
2
|
<tbody>
|
3
3
|
<tr>
|
4
4
|
<td align="center">
|
5
5
|
<!--[if (gte mso 9)|(IE)]>
|
6
|
-
<table align="center">
|
6
|
+
<table align="center" role="presentation">
|
7
7
|
<tbody>
|
8
8
|
<tr>
|
9
9
|
<td width="600">
|
10
10
|
<![endif]-->
|
11
|
-
<table align="center">
|
11
|
+
<table align="center" role="presentation">
|
12
12
|
<tbody>
|
13
13
|
<tr>
|
14
14
|
<td>
|
15
|
-
|
15
|
+
{{ contents }}
|
16
16
|
</td>
|
17
17
|
</tr>
|
18
18
|
</tbody>
|
@@ -5,6 +5,7 @@ require 'premailer'
|
|
5
5
|
require 'sassc'
|
6
6
|
require 'digest/sha1'
|
7
7
|
require 'css_parser'
|
8
|
+
require 'fileutils'
|
8
9
|
|
9
10
|
begin
|
10
11
|
require 'rails'
|
@@ -15,10 +16,14 @@ if defined?(Rails)
|
|
15
16
|
end
|
16
17
|
|
17
18
|
require_relative 'bootstrap-email/initialize'
|
19
|
+
require_relative 'bootstrap-email/config'
|
20
|
+
require_relative 'bootstrap-email/setup'
|
21
|
+
require_relative 'bootstrap-email/erb'
|
18
22
|
require_relative 'bootstrap-email/compiler'
|
19
23
|
require_relative 'bootstrap-email/sass_cache'
|
20
24
|
require_relative 'bootstrap-email/version'
|
21
|
-
|
25
|
+
require_relative 'bootstrap-email/converters/base'
|
26
|
+
Dir[File.join(__dir__, 'bootstrap-email/converters', '*.rb')].each { |file| require_relative file }
|
22
27
|
|
23
28
|
if defined?(Rails)
|
24
29
|
require_relative 'bootstrap-email/rails/action_mailer'
|
@@ -1,10 +1,9 @@
|
|
1
|
-
require_relative '../
|
1
|
+
require_relative '../bootstrap-email'
|
2
2
|
require 'optparse'
|
3
|
-
require 'fileutils'
|
4
3
|
|
5
4
|
input = nil
|
6
5
|
options = {
|
7
|
-
destination: '
|
6
|
+
destination: 'compiled',
|
8
7
|
type: :file
|
9
8
|
}
|
10
9
|
|
@@ -17,7 +16,7 @@ parser = OptionParser.new do |opts|
|
|
17
16
|
opts.separator ' bootstrap-email email.html > out.html'
|
18
17
|
opts.separator ' bootstrap-email ./public/index.html'
|
19
18
|
opts.separator ' bootstrap-email -s \'<a href="#" class="btn btn-primary">Some Button</a>\''
|
20
|
-
opts.separator ' bootstrap-email -p \'emails/*\' -d emails/
|
19
|
+
opts.separator ' bootstrap-email -p \'emails/*\' -d emails/compiled'
|
21
20
|
opts.separator ' bootstrap-email -p \'views/emails/*\' -d \'views/compiled_emails\''
|
22
21
|
opts.separator ' cat input.html | bootstrap-email'
|
23
22
|
opts.separator ''
|
@@ -37,7 +36,7 @@ parser = OptionParser.new do |opts|
|
|
37
36
|
options[:destination] = v
|
38
37
|
end
|
39
38
|
|
40
|
-
opts.on('-c', '--config STRING', String, 'Relative path to
|
39
|
+
opts.on('-c', '--config STRING', String, 'Relative path to ruby config file to customize Bootstrap Email.') do |v|
|
41
40
|
options[:config] = File.expand_path(v, Dir.pwd)
|
42
41
|
end
|
43
42
|
|
@@ -76,14 +75,15 @@ if input
|
|
76
75
|
|
77
76
|
puts "Compiling file #{path}"
|
78
77
|
compiled = BootstrapEmail::Compiler.new(path, type: :file, options: {config_path: options[:config]}).perform_full_compile
|
79
|
-
|
80
|
-
|
78
|
+
destination = options[:destination].chomp('/*')
|
79
|
+
FileUtils.mkdir_p("#{Dir.pwd}/#{destination}")
|
80
|
+
File.write(File.expand_path("#{destination}/#{path.split('/').last}", Dir.pwd), compiled)
|
81
81
|
end
|
82
82
|
when :file
|
83
83
|
path = File.expand_path(input, Dir.pwd)
|
84
|
-
puts BootstrapEmail::Compiler.new(
|
84
|
+
puts BootstrapEmail::Compiler.new(path, type: :file, options: {config_path: options[:config], sass_log_enabled: false}).perform_full_compile
|
85
85
|
when :string
|
86
|
-
puts BootstrapEmail::Compiler.new(input, options: {config_path: options[:config]}).perform_full_compile
|
86
|
+
puts BootstrapEmail::Compiler.new(input, options: {config_path: options[:config], sass_log_enabled: false}).perform_full_compile
|
87
87
|
end
|
88
88
|
else
|
89
89
|
puts opts
|
@@ -3,6 +3,7 @@ module BootstrapEmail
|
|
3
3
|
attr_accessor :type, :doc, :premailer
|
4
4
|
|
5
5
|
def initialize(input, type: :string, options: {})
|
6
|
+
BootstrapEmail.load_options(options)
|
6
7
|
self.type = type
|
7
8
|
case type
|
8
9
|
when :rails
|
@@ -13,23 +14,36 @@ module BootstrapEmail
|
|
13
14
|
when :file
|
14
15
|
html = File.read(input)
|
15
16
|
end
|
16
|
-
|
17
|
+
html = add_layout!(html)
|
18
|
+
sass_load_paths
|
19
|
+
build_premailer_doc(html)
|
17
20
|
end
|
18
21
|
|
19
22
|
def perform_full_compile
|
20
23
|
compile_html!
|
21
24
|
inline_css!
|
22
|
-
|
23
|
-
inject_comment!
|
25
|
+
configure_html!
|
24
26
|
finalize_document!
|
25
27
|
end
|
26
28
|
|
27
29
|
private
|
28
30
|
|
29
|
-
def
|
30
|
-
|
31
|
-
|
32
|
-
|
31
|
+
def add_layout!(html)
|
32
|
+
document = Nokogiri::HTML(html)
|
33
|
+
return html unless document.at_css('head').nil?
|
34
|
+
|
35
|
+
BootstrapEmail::Erb.template(
|
36
|
+
File.expand_path('../../core/layout.html.erb', __dir__),
|
37
|
+
contents: html
|
38
|
+
)
|
39
|
+
end
|
40
|
+
|
41
|
+
def sass_load_paths
|
42
|
+
SassC.load_paths << BootstrapEmail.config.sass_load_paths
|
43
|
+
end
|
44
|
+
|
45
|
+
def build_premailer_doc(html)
|
46
|
+
css_string = BootstrapEmail::SassCache.compile('bootstrap-email', style: :expanded)
|
33
47
|
self.premailer = Premailer.new(
|
34
48
|
html,
|
35
49
|
with_html_string: true,
|
@@ -39,80 +53,50 @@ module BootstrapEmail
|
|
39
53
|
self.doc = premailer.doc
|
40
54
|
end
|
41
55
|
|
42
|
-
def
|
43
|
-
|
44
|
-
return document.to_html unless document.at_css('head').nil?
|
56
|
+
def compile_html!
|
57
|
+
BootstrapEmail::Converter::Block.build(doc)
|
45
58
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
59
|
+
BootstrapEmail::Converter::Button.build(doc)
|
60
|
+
BootstrapEmail::Converter::Badge.build(doc)
|
61
|
+
BootstrapEmail::Converter::Alert.build(doc)
|
62
|
+
BootstrapEmail::Converter::Card.build(doc)
|
63
|
+
BootstrapEmail::Converter::Hr.build(doc)
|
64
|
+
BootstrapEmail::Converter::Container.build(doc)
|
65
|
+
BootstrapEmail::Converter::Grid.build(doc)
|
66
|
+
BootstrapEmail::Converter::Stack.build(doc)
|
50
67
|
|
51
|
-
|
52
|
-
BootstrapEmail::
|
53
|
-
BootstrapEmail::
|
54
|
-
BootstrapEmail::
|
55
|
-
|
56
|
-
BootstrapEmail::
|
57
|
-
BootstrapEmail::
|
58
|
-
BootstrapEmail::
|
59
|
-
BootstrapEmail::
|
60
|
-
|
61
|
-
BootstrapEmail::
|
62
|
-
BootstrapEmail::Component::Padding.build(doc)
|
63
|
-
BootstrapEmail::Component::Margin.build(doc)
|
64
|
-
BootstrapEmail::Component::Spacing.build(doc)
|
65
|
-
BootstrapEmail::Component::Spacer.build(doc)
|
66
|
-
BootstrapEmail::Component::Table.build(doc)
|
67
|
-
BootstrapEmail::Component::Body.build(doc)
|
68
|
+
BootstrapEmail::Converter::Spacing.build(doc)
|
69
|
+
BootstrapEmail::Converter::Padding.build(doc)
|
70
|
+
BootstrapEmail::Converter::Margin.build(doc)
|
71
|
+
BootstrapEmail::Converter::Spacer.build(doc)
|
72
|
+
|
73
|
+
BootstrapEmail::Converter::Table.build(doc)
|
74
|
+
BootstrapEmail::Converter::Body.build(doc)
|
75
|
+
BootstrapEmail::Converter::Align.build(doc)
|
76
|
+
BootstrapEmail::Converter::Color.build(doc)
|
77
|
+
|
78
|
+
BootstrapEmail::Converter::PreviewText.build(doc)
|
68
79
|
end
|
69
80
|
|
70
81
|
def inline_css!
|
71
82
|
premailer.to_inline_css
|
72
83
|
end
|
73
84
|
|
74
|
-
def
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
def inject_comment!
|
79
|
-
doc.at_css('head').prepend_child(bootstrap_email_comment)
|
85
|
+
def configure_html!
|
86
|
+
BootstrapEmail::Converter::ForceEncoding.build(doc)
|
87
|
+
BootstrapEmail::Converter::HeadStyle.build(doc)
|
88
|
+
BootstrapEmail::Converter::VersionComment.build(doc)
|
80
89
|
end
|
81
90
|
|
82
91
|
def finalize_document!
|
92
|
+
html = BootstrapEmail::Converter::ForceEncoding.replace(doc.to_html)
|
83
93
|
case type
|
84
94
|
when :rails
|
85
|
-
(@mail.html_part || @mail).body =
|
95
|
+
(@mail.html_part || @mail).body = html
|
86
96
|
@mail
|
87
97
|
when :string, :file
|
88
|
-
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
def bootstrap_email_head
|
93
|
-
html_string = <<-INLINE
|
94
|
-
<style type="text/css">
|
95
|
-
#{purged_css_from_head}
|
96
|
-
</style>
|
97
|
-
INLINE
|
98
|
-
html_string
|
99
|
-
end
|
100
|
-
|
101
|
-
def bootstrap_email_comment
|
102
|
-
"\n <!-- Compiled with Bootstrap Email version: #{BootstrapEmail::VERSION} -->"
|
103
|
-
end
|
104
|
-
|
105
|
-
def purged_css_from_head
|
106
|
-
default, custom = BootstrapEmail::SassCache.compile('bootstrap-head').split('/*! allow_purge_after */')
|
107
|
-
# get each CSS declaration
|
108
|
-
custom.scan(/\w*\.[\w\-]*[\s\S\n]+?(?=})}{1}/).each do |group|
|
109
|
-
# get the first class for each comma separated CSS declaration
|
110
|
-
exist = group.scan(/(\.[\w\-]*).*?((,+?)|{+?)/).map(&:first).uniq.any? do |selector|
|
111
|
-
!doc.at_css(selector).nil?
|
112
|
-
end
|
113
|
-
custom.sub!(group, '') unless exist
|
98
|
+
html
|
114
99
|
end
|
115
|
-
(default + custom).gsub(/\n\s*\n+/, "\n")
|
116
100
|
end
|
117
101
|
end
|
118
102
|
end
|