bootstrap-sass 3.3.4.1 → 3.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +1 -0
- data/.travis.yml +8 -12
- data/CHANGELOG.md +26 -0
- data/Gemfile +1 -4
- data/LICENSE +2 -1
- data/README.md +80 -74
- data/Rakefile +46 -11
- data/assets/javascripts/bootstrap.js +441 -178
- data/assets/javascripts/bootstrap.min.js +4 -5
- data/assets/javascripts/bootstrap/affix.js +8 -6
- data/assets/javascripts/bootstrap/alert.js +6 -5
- data/assets/javascripts/bootstrap/button.js +24 -15
- data/assets/javascripts/bootstrap/carousel.js +16 -7
- data/assets/javascripts/bootstrap/collapse.js +7 -6
- data/assets/javascripts/bootstrap/dropdown.js +49 -45
- data/assets/javascripts/bootstrap/modal.js +47 -28
- data/assets/javascripts/bootstrap/popover.js +25 -10
- data/assets/javascripts/bootstrap/scrollspy.js +4 -4
- data/assets/javascripts/bootstrap/tab.js +13 -11
- data/assets/javascripts/bootstrap/tooltip.js +232 -31
- data/assets/javascripts/bootstrap/transition.js +5 -5
- data/assets/stylesheets/_bootstrap-mincer.scss +2 -2
- data/assets/stylesheets/_bootstrap.scss +6 -0
- data/assets/stylesheets/bootstrap/_alerts.scss +3 -3
- data/assets/stylesheets/bootstrap/_badges.scss +3 -3
- data/assets/stylesheets/bootstrap/_breadcrumbs.scss +3 -1
- data/assets/stylesheets/bootstrap/_button-groups.scss +9 -8
- data/assets/stylesheets/bootstrap/_buttons.scss +17 -9
- data/assets/stylesheets/bootstrap/_carousel.scss +34 -32
- data/assets/stylesheets/bootstrap/_close.scss +1 -0
- data/assets/stylesheets/bootstrap/_code.scss +3 -3
- data/assets/stylesheets/bootstrap/_component-animations.scss +1 -0
- data/assets/stylesheets/bootstrap/_dropdowns.scss +22 -23
- data/assets/stylesheets/bootstrap/_forms.scss +101 -72
- data/assets/stylesheets/bootstrap/_glyphicons.scss +15 -13
- data/assets/stylesheets/bootstrap/_grid.scss +10 -0
- data/assets/stylesheets/bootstrap/_input-groups.scss +10 -5
- data/assets/stylesheets/bootstrap/_jumbotron.scss +8 -4
- data/assets/stylesheets/bootstrap/_labels.scss +1 -1
- data/assets/stylesheets/bootstrap/_list-group.scss +30 -26
- data/assets/stylesheets/bootstrap/_media.scss +6 -1
- data/assets/stylesheets/bootstrap/_mixins.scss +1 -0
- data/assets/stylesheets/bootstrap/_modals.scss +8 -8
- data/assets/stylesheets/bootstrap/_navbar.scss +75 -81
- data/assets/stylesheets/bootstrap/_navs.scss +4 -4
- data/assets/stylesheets/bootstrap/_normalize.scss +13 -13
- data/assets/stylesheets/bootstrap/_pager.scss +2 -2
- data/assets/stylesheets/bootstrap/_pagination.scss +15 -17
- data/assets/stylesheets/bootstrap/_panels.scss +11 -5
- data/assets/stylesheets/bootstrap/_popovers.scss +50 -59
- data/assets/stylesheets/bootstrap/_print.scss +90 -98
- data/assets/stylesheets/bootstrap/_progress-bars.scss +3 -3
- data/assets/stylesheets/bootstrap/_responsive-embed.scss +2 -2
- data/assets/stylesheets/bootstrap/_responsive-utilities.scss +7 -5
- data/assets/stylesheets/bootstrap/_scaffolding.scss +8 -9
- data/assets/stylesheets/bootstrap/_tables.scss +23 -23
- data/assets/stylesheets/bootstrap/_theme.scss +42 -20
- data/assets/stylesheets/bootstrap/_thumbnails.scss +1 -1
- data/assets/stylesheets/bootstrap/_tooltip.scss +42 -32
- data/assets/stylesheets/bootstrap/_type.scss +11 -11
- data/assets/stylesheets/bootstrap/_variables.scss +16 -8
- data/assets/stylesheets/bootstrap/_wells.scss +2 -2
- data/assets/stylesheets/bootstrap/mixins/_alerts.scss +2 -1
- data/assets/stylesheets/bootstrap/mixins/_background-variant.scss +2 -1
- data/assets/stylesheets/bootstrap/mixins/_border-radius.scss +4 -4
- data/assets/stylesheets/bootstrap/mixins/_buttons.scss +20 -11
- data/assets/stylesheets/bootstrap/mixins/_center-block.scss +1 -1
- data/assets/stylesheets/bootstrap/mixins/_clearfix.scss +1 -1
- data/assets/stylesheets/bootstrap/mixins/_forms.scss +4 -4
- data/assets/stylesheets/bootstrap/mixins/_gradients.scss +6 -8
- data/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +2 -2
- data/assets/stylesheets/bootstrap/mixins/_grid.scss +8 -8
- data/assets/stylesheets/bootstrap/mixins/_hide-text.scss +2 -2
- data/assets/stylesheets/bootstrap/mixins/_image.scss +5 -10
- data/assets/stylesheets/bootstrap/mixins/_list-group.scss +3 -2
- data/assets/stylesheets/bootstrap/mixins/_opacity.scss +2 -3
- data/assets/stylesheets/bootstrap/mixins/_pagination.scss +2 -1
- data/assets/stylesheets/bootstrap/mixins/_reset-text.scss +18 -0
- data/assets/stylesheets/bootstrap/mixins/_resize.scss +1 -1
- data/assets/stylesheets/bootstrap/mixins/_responsive-visibility.scss +1 -5
- data/assets/stylesheets/bootstrap/mixins/_tab-focus.scss +3 -3
- data/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss +2 -1
- data/assets/stylesheets/bootstrap/mixins/_vendor-prefixes.scss +3 -3
- data/bootstrap-sass.gemspec +10 -9
- data/bower.json +5 -9
- data/composer.json +2 -2
- data/eyeglass-exports.js +7 -0
- data/lib/bootstrap-sass.rb +18 -11
- data/lib/bootstrap-sass/engine.rb +6 -1
- data/lib/bootstrap-sass/version.rb +2 -2
- data/package-lock.json +1611 -0
- data/package.json +20 -6
- data/sache.json +1 -1
- data/tasks/converter/less_conversion.rb +20 -9
- data/tasks/converter/network.rb +2 -2
- data/templates/project/_bootstrap-variables.sass +17 -9
- data/test/compilation_test.rb +24 -12
- data/test/dummy_rails/config/application.rb +2 -1
- data/test/dummy_rails/config/boot.rb +1 -1
- data/test/dummy_sass_only/Gemfile +1 -1
- data/test/dummy_sass_only/compile.rb +14 -7
- data/test/dummy_sass_only/import_all.scss +2 -0
- data/test/gemfiles/default.gemfile +3 -0
- data/test/node_mincer_test.rb +2 -3
- data/test/node_sass_compile_test.sh +4 -3
- data/test/sass_test.rb +10 -7
- data/test/sprockets_rails_test.rb +12 -8
- data/test/support/dummy_rails_integration.rb +1 -1
- data/test/support/reporting.rb +10 -0
- data/test/test_helper.rb +3 -2
- metadata +38 -29
- data/test/compass_test.rb +0 -9
- data/test/dummy_sass_only/import_all.sass +0 -2
- data/test/gemfiles/sass_3_2.gemfile +0 -6
- data/test/gemfiles/sass_3_3.gemfile +0 -6
- data/test/gemfiles/sass_3_4.gemfile +0 -7
- data/test/gemfiles/sass_head.gemfile +0 -6
data/package.json
CHANGED
@@ -1,8 +1,17 @@
|
|
1
1
|
{
|
2
2
|
"name": "bootstrap-sass",
|
3
|
-
"version": "3.
|
4
|
-
"description": "bootstrap-sass is a Sass-powered version of Bootstrap, ready to drop right into your Sass powered applications.",
|
3
|
+
"version": "3.4.1",
|
4
|
+
"description": "bootstrap-sass is a Sass-powered version of Bootstrap 3, ready to drop right into your Sass powered applications.",
|
5
5
|
"main": "assets/javascripts/bootstrap.js",
|
6
|
+
"style": "assets/stylesheets/_bootstrap.scss",
|
7
|
+
"sass": "assets/stylesheets/_bootstrap.scss",
|
8
|
+
"files": [
|
9
|
+
"assets",
|
10
|
+
"eyeglass-exports.js",
|
11
|
+
"CHANGELOG.md",
|
12
|
+
"LICENSE",
|
13
|
+
"README.md"
|
14
|
+
],
|
6
15
|
"repository": {
|
7
16
|
"type": "git",
|
8
17
|
"url": "git://github.com/twbs/bootstrap-sass"
|
@@ -10,7 +19,8 @@
|
|
10
19
|
"keywords": [
|
11
20
|
"bootstrap",
|
12
21
|
"sass",
|
13
|
-
"css"
|
22
|
+
"css",
|
23
|
+
"eyeglass-module"
|
14
24
|
],
|
15
25
|
"contributors": [
|
16
26
|
"Thomas McDonald",
|
@@ -23,8 +33,12 @@
|
|
23
33
|
"url": "https://github.com/twbs/bootstrap-sass/issues"
|
24
34
|
},
|
25
35
|
"devDependencies": {
|
26
|
-
"node-sass": "
|
27
|
-
"mincer": "~1.
|
28
|
-
"ejs": "~1
|
36
|
+
"node-sass": "^4.9.3",
|
37
|
+
"mincer": "~1.4.0",
|
38
|
+
"ejs": "~2.6.1"
|
39
|
+
},
|
40
|
+
"eyeglass": {
|
41
|
+
"exports": "eyeglass-exports.js",
|
42
|
+
"needs": "^0.7.1"
|
29
43
|
}
|
30
44
|
}
|
data/sache.json
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
{
|
2
2
|
"name": "bootstrap-sass",
|
3
|
-
"description": "bootstrap-sass is a Sass-powered version of Bootstrap, ready to drop right into your Sass powered applications",
|
3
|
+
"description": "bootstrap-sass is a Sass-powered version of Bootstrap 3, ready to drop right into your Sass powered applications.",
|
4
4
|
"tags": ["bootstrap", "grid", "typography", "buttons", "ui", "responsive-web-design"]
|
5
5
|
}
|
@@ -67,6 +67,7 @@ class Converter
|
|
67
67
|
log_processing name
|
68
68
|
# apply common conversions
|
69
69
|
file = convert_less(file)
|
70
|
+
file = replace_all file, %r{// stylelint-disable.*?\n+}, '', optional: true
|
70
71
|
if name.start_with?('mixins/')
|
71
72
|
file = varargify_mixin_definitions(file, *VARARG_MIXINS)
|
72
73
|
%w(responsive-(in)?visibility input-size text-emphasis-variant bg-variant).each do |mixin|
|
@@ -102,6 +103,11 @@ class Converter
|
|
102
103
|
// [converter] This is because some asset helpers, such as Sprockets, do not work with file-relative paths.
|
103
104
|
\\1: if($bootstrap-sass-asset-helper, "bootstrap/", "\\2bootstrap/") \\3;
|
104
105
|
SCSS
|
106
|
+
when 'breadcrumbs.less'
|
107
|
+
file = replace_all file, /(.*)(\\00a0)/, unindent(<<-SCSS, 8) + "\\1\#{$nbsp}"
|
108
|
+
// [converter] Workaround for https://github.com/sass/libsass/issues/1115
|
109
|
+
$nbsp: "\\2";
|
110
|
+
SCSS
|
105
111
|
when 'close.less'
|
106
112
|
# extract .close { button& {...} } rule
|
107
113
|
file = extract_nested_rule file, 'button&'
|
@@ -118,13 +124,10 @@ class Converter
|
|
118
124
|
file = replace_all file, /(\s*)\.navbar-(right|left)\s*\{\s*@extend\s*\.pull-(right|left);\s*/, "\\1.navbar-\\2 {\\1 float: \\2 !important;\\1"
|
119
125
|
when 'tables.less'
|
120
126
|
file = replace_all file, /(@include\s*table-row-variant\()(\w+)/, "\\1'\\2'"
|
121
|
-
when 'thumbnails.less', 'labels.less', 'badges.less'
|
127
|
+
when 'thumbnails.less', 'labels.less', 'badges.less', 'buttons.less'
|
122
128
|
file = extract_nested_rule file, 'a&'
|
123
129
|
when 'glyphicons.less'
|
124
|
-
file = replace_rules(file,
|
125
|
-
rule = replace_all rule, /(\$icon-font(?:-\w+)+)/, '#{\1}'
|
126
|
-
replace_asset_url rule, :font
|
127
|
-
}
|
130
|
+
file = replace_rules(file, /\s*@font-face/) { |rule| replace_asset_url rule, :font }
|
128
131
|
when 'type.less'
|
129
132
|
file = apply_mixin_parent_selector(file, '\.(text|bg)-(success|primary|info|warning|danger)')
|
130
133
|
# .bg-primary will not get patched automatically as it includes an additional rule. fudge for now
|
@@ -169,9 +172,16 @@ class Converter
|
|
169
172
|
file = deinterpolate_vararg_mixins(file)
|
170
173
|
file = replace_calculation_semantics(file)
|
171
174
|
file = replace_file_imports(file)
|
175
|
+
file = wrap_at_groups_with_at_root(file)
|
172
176
|
file
|
173
177
|
end
|
174
178
|
|
179
|
+
def wrap_at_groups_with_at_root(file)
|
180
|
+
replace_rules(file, /@(?:font-face|-ms-viewport)/) { |rule, _pos|
|
181
|
+
%Q(@at-root {\n#{indent rule, 2}\n})
|
182
|
+
}
|
183
|
+
end
|
184
|
+
|
175
185
|
def sass_fn_exists(fn)
|
176
186
|
%Q{(#{fn}("") != unquote('#{fn}("")'))}
|
177
187
|
end
|
@@ -313,10 +323,10 @@ SASS
|
|
313
323
|
%Q(@import "#{target_path}\\1";)
|
314
324
|
end
|
315
325
|
|
316
|
-
def replace_all(file, regex, replacement = nil, &block)
|
326
|
+
def replace_all(file, regex, replacement = nil, optional: false, &block)
|
317
327
|
log_transform regex, replacement
|
318
328
|
new_file = file.gsub(regex, replacement, &block)
|
319
|
-
raise "replace_all #{regex}, #{replacement} NO MATCH" if file == new_file
|
329
|
+
raise "replace_all #{regex}, #{replacement} NO MATCH" if !optional && file == new_file
|
320
330
|
new_file
|
321
331
|
end
|
322
332
|
|
@@ -453,7 +463,7 @@ SASS
|
|
453
463
|
def replace_ms_filters(file)
|
454
464
|
log_transform
|
455
465
|
file.gsub(
|
456
|
-
/filter: e\(%\("progid:DXImageTransform.Microsoft.gradient\(startColorstr='%d', endColorstr='%d', GradientType=(\d)\)",argb\(([\-$\w]+)\),argb\(([\-$\w]+)\)\)\);/,
|
466
|
+
/filter: e\(%\("progid:DXImageTransform.Microsoft.gradient\(startColorstr='%d', endColorstr='%d', GradientType=(\d)\)", ?argb\(([\-$\w]+)\), ?argb\(([\-$\w]+)\)\)\);/,
|
457
467
|
%Q(filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='\#{ie-hex-str(\\2)}', endColorstr='\#{ie-hex-str(\\3)}', GradientType=\\1);)
|
458
468
|
)
|
459
469
|
end
|
@@ -499,7 +509,8 @@ SASS
|
|
499
509
|
def replace_escaping(less)
|
500
510
|
less = less.gsub(/~"([^"]+)"/, '\1').gsub(/~'([^']+)'/, '\1') # Get rid of ~"" escape
|
501
511
|
less.gsub!(/\$\{([^}]+)\}/, '$\1') # Get rid of @{} escape
|
502
|
-
|
512
|
+
# interpolate variables in strings, e.g. url("$file-1x") => url("#{$file-1x}")
|
513
|
+
less.gsub!(/"[^"\n]*"/) { |str| str.gsub(/\$[^"\n$.\\]+/, '#{\0}') }
|
503
514
|
less.gsub(/(\W)e\(%\("?([^"]*)"?\)\)/, '\1\2') # Get rid of e(%("")) escape
|
504
515
|
end
|
505
516
|
|
data/tasks/converter/network.rb
CHANGED
@@ -32,7 +32,7 @@ class Converter
|
|
32
32
|
if File.directory?(full_path)
|
33
33
|
files.each do |name|
|
34
34
|
path = "#{full_path}/#{name}"
|
35
|
-
contents[name] = File.read(path, mode: 'rb') if File.
|
35
|
+
contents[name] = File.read(path, mode: 'rb') if File.exist?(path)
|
36
36
|
end
|
37
37
|
end
|
38
38
|
contents
|
@@ -51,7 +51,7 @@ class Converter
|
|
51
51
|
uri = URI(url)
|
52
52
|
cache_path = "./#@cache_path#{uri.path}#{uri.query.tr('?&=', '-') if uri.query}"
|
53
53
|
FileUtils.mkdir_p File.dirname(cache_path)
|
54
|
-
if File.
|
54
|
+
if File.exist?(cache_path)
|
55
55
|
log_http_get_file url, true
|
56
56
|
File.read(cache_path, mode: 'rb')
|
57
57
|
else
|
@@ -1,4 +1,4 @@
|
|
1
|
-
// Override Bootstrap variables here (defaults from bootstrap-sass v3.
|
1
|
+
// Override Bootstrap variables here (defaults from bootstrap-sass v3.4.0):
|
2
2
|
|
3
3
|
//
|
4
4
|
// Variables
|
@@ -52,14 +52,14 @@
|
|
52
52
|
|
53
53
|
// $font-size-base: 14px
|
54
54
|
// $font-size-large: ceil(($font-size-base * 1.25)) // ~18px
|
55
|
-
// $font-size-small: ceil(($font-size-base *
|
55
|
+
// $font-size-small: ceil(($font-size-base * .85)) // ~12px
|
56
56
|
|
57
57
|
// $font-size-h1: floor(($font-size-base * 2.6)) // ~36px
|
58
58
|
// $font-size-h2: floor(($font-size-base * 2.15)) // ~30px
|
59
59
|
// $font-size-h3: ceil(($font-size-base * 1.7)) // ~24px
|
60
60
|
// $font-size-h4: ceil(($font-size-base * 1.25)) // ~18px
|
61
61
|
// $font-size-h5: $font-size-base
|
62
|
-
// $font-size-h6: ceil(($font-size-base *
|
62
|
+
// $font-size-h6: ceil(($font-size-base * .85)) // ~12px
|
63
63
|
|
64
64
|
//** Unit-less `line-height` for use in components like buttons.
|
65
65
|
// $line-height-base: 1.428571429 // 20/14
|
@@ -117,7 +117,7 @@
|
|
117
117
|
//** Global background color for active items (e.g., navs or dropdowns).
|
118
118
|
// $component-active-bg: $brand-primary
|
119
119
|
|
120
|
-
//** Width of the `border` for generating carets that
|
120
|
+
//** Width of the `border` for generating carets that indicate dropdowns.
|
121
121
|
// $caret-width-base: 4px
|
122
122
|
//** Carets increase slightly in size for larger components.
|
123
123
|
// $caret-width-large: 5px
|
@@ -176,6 +176,11 @@
|
|
176
176
|
|
177
177
|
// $btn-link-disabled-color: $gray-light
|
178
178
|
|
179
|
+
// Allows for customizing button radius independently from global border radius
|
180
|
+
// $btn-border-radius-base: $border-radius-base
|
181
|
+
// $btn-border-radius-large: $border-radius-large
|
182
|
+
// $btn-border-radius-small: $border-radius-small
|
183
|
+
|
179
184
|
|
180
185
|
//== Forms
|
181
186
|
//
|
@@ -235,7 +240,7 @@
|
|
235
240
|
//** Background for the dropdown menu.
|
236
241
|
// $dropdown-bg: #fff
|
237
242
|
//** Dropdown menu `border-color`.
|
238
|
-
// $dropdown-border: rgba(0,0,0
|
243
|
+
// $dropdown-border: rgba(0, 0, 0, .15)
|
239
244
|
//** Dropdown menu `border-color` **for IE8**.
|
240
245
|
// $dropdown-fallback-border: #ccc
|
241
246
|
//** Divider color for between dropdown items.
|
@@ -389,7 +394,7 @@
|
|
389
394
|
// $navbar-default-toggle-border-color: #ddd
|
390
395
|
|
391
396
|
|
392
|
-
|
397
|
+
//=== Inverted navbar
|
393
398
|
// Reset inverted navbar basics
|
394
399
|
// $navbar-inverse-color: lighten($gray-light, 15%)
|
395
400
|
// $navbar-inverse-bg: #222
|
@@ -490,6 +495,7 @@
|
|
490
495
|
// $jumbotron-bg: $gray-lighter
|
491
496
|
// $jumbotron-heading-color: inherit
|
492
497
|
// $jumbotron-font-size: ceil(($font-size-base * 1.5))
|
498
|
+
// $jumbotron-heading-font-size: ceil(($font-size-base * 4.5))
|
493
499
|
|
494
500
|
|
495
501
|
//== Form states and alerts
|
@@ -540,7 +546,7 @@
|
|
540
546
|
//** Popover maximum width
|
541
547
|
// $popover-max-width: 276px
|
542
548
|
//** Popover border color
|
543
|
-
// $popover-border-color: rgba(0,0,0
|
549
|
+
// $popover-border-color: rgba(0, 0, 0, .2)
|
544
550
|
//** Popover fallback border color
|
545
551
|
// $popover-fallback-border-color: #ccc
|
546
552
|
|
@@ -598,7 +604,7 @@
|
|
598
604
|
//** Background color of modal content area
|
599
605
|
// $modal-content-bg: #fff
|
600
606
|
//** Modal content border color
|
601
|
-
// $modal-content-border-color: rgba(0,0,0
|
607
|
+
// $modal-content-border-color: rgba(0, 0, 0, .2)
|
602
608
|
//** Modal content border color **for IE8**
|
603
609
|
// $modal-content-fallback-border-color: #999
|
604
610
|
|
@@ -803,7 +809,7 @@
|
|
803
809
|
//
|
804
810
|
//##
|
805
811
|
|
806
|
-
// $carousel-text-shadow: 0 1px 2px rgba(0,0,0
|
812
|
+
// $carousel-text-shadow: 0 1px 2px rgba(0, 0, 0, .6)
|
807
813
|
|
808
814
|
// $carousel-control-color: #fff
|
809
815
|
// $carousel-control-width: 15%
|
@@ -863,5 +869,7 @@
|
|
863
869
|
// $page-header-border-color: $gray-lighter
|
864
870
|
//** Width of horizontal description list titles
|
865
871
|
// $dl-horizontal-offset: $component-offset-horizontal
|
872
|
+
//** Point at which .dl-horizontal becomes horizontal
|
873
|
+
// $dl-horizontal-breakpoint: $grid-float-breakpoint
|
866
874
|
//** Horizontal line color.
|
867
875
|
// $hr-border: $gray-lighter
|
data/test/compilation_test.rb
CHANGED
@@ -1,18 +1,30 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
require 'fileutils'
|
3
|
-
require '
|
3
|
+
require 'sassc'
|
4
4
|
|
5
5
|
class CompilationTest < Minitest::Test
|
6
|
-
def
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
6
|
+
def test_compilation_bootstrap
|
7
|
+
compile 'bootstrap'
|
8
|
+
assert true # nothing was raised
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_compilation_bootstrap_theme
|
12
|
+
compile 'bootstrap/theme'
|
13
|
+
assert true # nothing was raised
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def compile(file)
|
19
|
+
path = File.expand_path('../assets/stylesheets', __dir__)
|
20
|
+
FileUtils.rm_rf('.sass-cache', secure: true)
|
21
|
+
engine = SassC::Engine.new(
|
22
|
+
%Q{@import "#{path}/#{file}"},
|
23
|
+
syntax: :scss, load_paths: ['.']
|
24
|
+
)
|
25
|
+
FileUtils.mkdir_p("tmp/#{File.dirname(file)}")
|
26
|
+
File.open("tmp/#{file}.css", 'w') { |f|
|
27
|
+
f.write engine.render
|
28
|
+
}
|
17
29
|
end
|
18
30
|
end
|
@@ -12,13 +12,14 @@ end
|
|
12
12
|
|
13
13
|
require 'slim-rails'
|
14
14
|
require 'jquery-rails'
|
15
|
-
require '
|
15
|
+
require 'sassc-rails'
|
16
16
|
require 'bootstrap-sass'
|
17
17
|
require 'uglifier'
|
18
18
|
|
19
19
|
module Dummy
|
20
20
|
class Application < Rails::Application
|
21
21
|
config.assets.enabled = true if config.assets.respond_to?(:enabled)
|
22
|
+
config.assets.precompile += %w( application.css application.js )
|
22
23
|
config.to_prepare do
|
23
24
|
if ENV['VERBOSE']
|
24
25
|
STDERR.puts "Loaded Rails #{Rails::VERSION::STRING}, Sprockets #{Sprockets::VERSION}",
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# Set up gems listed in the Gemfile.
|
2
2
|
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
|
3
3
|
|
4
|
-
require 'bundler/setup' if File.
|
4
|
+
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
|
5
5
|
$LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
|
@@ -1,13 +1,20 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'sassc'
|
2
4
|
require 'bootstrap-sass'
|
3
5
|
require 'fileutils'
|
4
6
|
|
5
|
-
|
6
|
-
|
7
|
+
load_path = ARGV[0]
|
8
|
+
out_path = ARGV[1]
|
9
|
+
|
10
|
+
output = SassC::Engine.new(
|
11
|
+
File.read(File.expand_path('./import_all.scss', __dir__)),
|
12
|
+
syntax: :scss, load_paths: ['.', load_path]
|
13
|
+
).render
|
7
14
|
|
8
|
-
if
|
9
|
-
FileUtils.mkdir_p
|
10
|
-
File.
|
15
|
+
if out_path
|
16
|
+
FileUtils.mkdir_p(File.dirname(out_path))
|
17
|
+
File.write(out_path, output)
|
11
18
|
else
|
12
|
-
puts
|
19
|
+
puts output
|
13
20
|
end
|
data/test/node_mincer_test.rb
CHANGED
@@ -22,15 +22,14 @@ class NodeMincerTest < Minitest::Test
|
|
22
22
|
|
23
23
|
def setup
|
24
24
|
tmp_dir = File.join GEM_PATH, 'tmp/node-mincer'
|
25
|
-
command = "node manifest.js #{tmp_dir}"
|
26
25
|
success = Dir.chdir DUMMY_PATH do
|
27
26
|
silence_stdout_if !ENV['VERBOSE'] do
|
28
|
-
system
|
27
|
+
system 'node', 'manifest.js', tmp_dir
|
29
28
|
end
|
30
29
|
end
|
31
30
|
assert success, 'Node.js Mincer compilation failed'
|
32
31
|
manifest = JSON.parse(File.read("#{tmp_dir}/manifest.json"))
|
33
|
-
css_name = manifest[
|
32
|
+
css_name = manifest['assets']['application.css']
|
34
33
|
@css = File.read("#{tmp_dir}/#{css_name}")
|
35
34
|
end
|
36
35
|
end
|
@@ -1,8 +1,9 @@
|
|
1
|
-
#!/bin/
|
1
|
+
#!/bin/bash
|
2
2
|
|
3
3
|
# Test compilation with node-sass binary
|
4
4
|
|
5
5
|
mkdir -p tmp/node-sass
|
6
|
-
node-sass assets/stylesheets/
|
7
|
-
node-sass assets/stylesheets/
|
6
|
+
node_modules/.bin/node-sass assets/stylesheets/_bootstrap.scss -o tmp/node-sass/bootstrap.css && \
|
7
|
+
node_modules/.bin/node-sass --include-path=assets/stylesheets/ \
|
8
|
+
assets/stylesheets/bootstrap/_theme.scss -o tmp/node-sass/bootstrap-theme.css || \
|
8
9
|
(echo "node-sass compilation failed" && exit 1)
|
data/test/sass_test.rb
CHANGED
@@ -1,23 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'test_helper'
|
2
4
|
require 'shellwords'
|
5
|
+
require 'fileutils'
|
6
|
+
require 'bootstrap-sass'
|
3
7
|
|
4
8
|
class SassTest < Minitest::Test
|
5
9
|
DUMMY_PATH = 'test/dummy_sass_only'
|
6
10
|
|
7
11
|
def test_font_helper
|
8
|
-
assert_match %r
|
12
|
+
assert_match %r{url\(['"]?.*eot['"]?\)}, @css
|
9
13
|
end
|
10
14
|
|
11
15
|
def setup
|
12
|
-
|
13
|
-
%x[rm -rf .sass-cache/]
|
14
|
-
%x[bundle]
|
15
|
-
end
|
16
|
+
FileUtils.rm_rf(File.join(DUMMY_PATH, '.sass-cache'), secure: true)
|
16
17
|
css_path = File.join GEM_PATH, 'tmp/bootstrap-sass-only.css'
|
17
|
-
command = "bundle exec ruby compile.rb #{Shellwords.escape css_path}"
|
18
18
|
success = Dir.chdir DUMMY_PATH do
|
19
19
|
silence_stdout_if !ENV['VERBOSE'] do
|
20
|
-
|
20
|
+
Bundler.with_original_env do
|
21
|
+
system('bundle') && system('bundle', 'exec', 'ruby', 'compile.rb',
|
22
|
+
Bootstrap.stylesheets_path, css_path)
|
23
|
+
end
|
21
24
|
end
|
22
25
|
end
|
23
26
|
assert success, 'Sass-only compilation failed'
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'test_helper'
|
2
4
|
require 'fileutils'
|
3
5
|
require 'find'
|
@@ -6,22 +8,24 @@ require 'shellwords'
|
|
6
8
|
class SprocketsRailsTest < Minitest::Test
|
7
9
|
|
8
10
|
def test_sprockets_digest_asset_refs
|
9
|
-
root
|
10
|
-
command = "bundle exec rake assets:precompile GEMFILE=#{GEM_PATH}/Gemfile RAILS_ENV=production"
|
11
|
+
root = 'test/dummy_rails'
|
11
12
|
compiled = Dir.chdir root do
|
12
13
|
silence_stderr_if !ENV['VERBOSE'] do
|
13
|
-
|
14
|
+
Bundler.with_original_env do
|
15
|
+
system({ 'BUNDLE_GEMFILE' => File.join(GEM_PATH, 'Gemfile'),
|
16
|
+
'RAILS_ENV' => 'production' },
|
17
|
+
'bundle && bundle exec rake assets:precompile')
|
18
|
+
end
|
14
19
|
end
|
15
20
|
end
|
16
21
|
assert compiled, 'Could not precompile assets'
|
17
22
|
Dir.glob(File.join(root, 'public', 'assets', 'app*.{css,js}')) do |path|
|
18
|
-
File.
|
19
|
-
|
20
|
-
|
21
|
-
end
|
23
|
+
File.read(path)
|
24
|
+
.scan(/url\("?[^"]+\.(?:jpg|png|eot|woff2?|ttf|svg)[^"]*"?\)/) do |m|
|
25
|
+
assert_match(/-[0-9a-f]{12,}\./, m)
|
22
26
|
end
|
23
27
|
end
|
24
28
|
ensure
|
25
|
-
FileUtils.rm_rf %W
|
29
|
+
FileUtils.rm_rf %W[#{root}/public/assets/ #{root}/tmp/cache/], secure: true
|
26
30
|
end
|
27
31
|
end
|