bootstrap-sass 3.3.1.0 → 3.3.6
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/.travis.yml +8 -8
- data/CHANGELOG.md +44 -0
- data/CONTRIBUTING.md +8 -1
- data/Gemfile +1 -1
- data/LICENSE +1 -1
- data/README.md +69 -49
- data/Rakefile +46 -4
- data/assets/fonts/bootstrap/glyphicons-halflings-regular.eot +0 -0
- data/assets/fonts/bootstrap/glyphicons-halflings-regular.svg +273 -214
- data/assets/fonts/bootstrap/glyphicons-halflings-regular.ttf +0 -0
- data/assets/fonts/bootstrap/glyphicons-halflings-regular.woff +0 -0
- data/assets/fonts/bootstrap/glyphicons-halflings-regular.woff2 +0 -0
- data/assets/javascripts/bootstrap/affix.js +7 -7
- data/assets/javascripts/bootstrap/alert.js +3 -3
- data/assets/javascripts/bootstrap/button.js +14 -10
- data/assets/javascripts/bootstrap/carousel.js +11 -14
- data/assets/javascripts/bootstrap/collapse.js +9 -9
- data/assets/javascripts/bootstrap/dropdown.js +49 -45
- data/assets/javascripts/bootstrap/modal.js +45 -32
- data/assets/javascripts/bootstrap/popover.js +9 -20
- data/assets/javascripts/bootstrap/scrollspy.js +18 -21
- data/assets/javascripts/bootstrap/tab.js +7 -5
- data/assets/javascripts/bootstrap/tooltip.js +82 -46
- data/assets/javascripts/bootstrap/transition.js +2 -2
- data/assets/javascripts/bootstrap-sprockets.js +2 -2
- data/assets/javascripts/bootstrap.js +1210 -1151
- data/assets/javascripts/bootstrap.min.js +7 -0
- data/assets/stylesheets/_bootstrap-compass.scss +2 -0
- data/assets/stylesheets/_bootstrap-mincer.scss +4 -2
- data/assets/stylesheets/_bootstrap-sprockets.scss +2 -0
- data/assets/stylesheets/_bootstrap.scss +6 -0
- data/assets/stylesheets/bootstrap/_alerts.scss +5 -0
- data/assets/stylesheets/bootstrap/_badges.scss +7 -2
- data/assets/stylesheets/bootstrap/_breadcrumbs.scss +3 -1
- data/assets/stylesheets/bootstrap/_button-groups.scss +5 -4
- data/assets/stylesheets/bootstrap/_buttons.scss +14 -6
- data/assets/stylesheets/bootstrap/_carousel.scss +16 -13
- data/assets/stylesheets/bootstrap/_close.scss +1 -0
- data/assets/stylesheets/bootstrap/_component-animations.scss +1 -2
- data/assets/stylesheets/bootstrap/_dropdowns.scss +6 -3
- data/assets/stylesheets/bootstrap/_forms.scss +98 -29
- data/assets/stylesheets/bootstrap/_glyphicons.scss +83 -10
- data/assets/stylesheets/bootstrap/_input-groups.scss +8 -3
- data/assets/stylesheets/bootstrap/_jumbotron.scss +8 -3
- data/assets/stylesheets/bootstrap/_list-group.scss +9 -3
- data/assets/stylesheets/bootstrap/_media.scss +19 -0
- data/assets/stylesheets/bootstrap/_mixins.scss +1 -0
- data/assets/stylesheets/bootstrap/_modals.scss +4 -2
- data/assets/stylesheets/bootstrap/_navbar.scss +1 -1
- data/assets/stylesheets/bootstrap/_navs.scss +0 -2
- data/assets/stylesheets/bootstrap/_normalize.scss +8 -11
- data/assets/stylesheets/bootstrap/_pagination.scss +4 -3
- data/assets/stylesheets/bootstrap/_panels.scss +11 -1
- data/assets/stylesheets/bootstrap/_popovers.scss +4 -8
- data/assets/stylesheets/bootstrap/_print.scss +0 -6
- data/assets/stylesheets/bootstrap/_responsive-embed.scss +8 -8
- data/assets/stylesheets/bootstrap/_responsive-utilities.scss +8 -3
- data/assets/stylesheets/bootstrap/_scaffolding.scss +11 -0
- data/assets/stylesheets/bootstrap/_tables.scss +3 -3
- data/assets/stylesheets/bootstrap/_theme.scss +26 -7
- data/assets/stylesheets/bootstrap/_tooltip.scss +4 -6
- data/assets/stylesheets/bootstrap/_type.scss +2 -2
- data/assets/stylesheets/bootstrap/_utilities.scss +0 -1
- data/assets/stylesheets/bootstrap/_variables.scss +20 -10
- data/assets/stylesheets/bootstrap/mixins/_background-variant.scss +2 -1
- data/assets/stylesheets/bootstrap/mixins/_buttons.scss +19 -6
- data/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +2 -2
- data/assets/stylesheets/bootstrap/mixins/_grid.scss +4 -4
- data/assets/stylesheets/bootstrap/mixins/_hide-text.scss +3 -3
- data/assets/stylesheets/bootstrap/mixins/_list-group.scss +3 -2
- data/assets/stylesheets/bootstrap/mixins/_opacity.scss +1 -1
- data/assets/stylesheets/bootstrap/mixins/_pagination.scss +2 -1
- data/assets/stylesheets/bootstrap/mixins/_reset-text.scss +18 -0
- data/assets/stylesheets/bootstrap/mixins/_responsive-visibility.scss +1 -1
- data/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss +2 -1
- data/assets/stylesheets/bootstrap/mixins/_vendor-prefixes.scss +3 -3
- data/bootstrap-sass.gemspec +9 -9
- data/bower.json +5 -19
- data/composer.json +1 -1
- data/lib/bootstrap-sass/engine.rb +6 -1
- data/lib/bootstrap-sass/version.rb +2 -2
- data/lib/bootstrap-sass.rb +27 -5
- data/package.json +6 -6
- data/sache.json +1 -1
- data/tasks/bower.rake +2 -5
- data/tasks/converter/fonts_conversion.rb +1 -1
- data/tasks/converter/js_conversion.rb +7 -5
- data/tasks/converter/less_conversion.rb +41 -29
- data/tasks/converter/network.rb +10 -5
- data/tasks/converter.rb +1 -1
- data/templates/project/_bootstrap-variables.sass +20 -11
- data/templates/project/styles.sass +3 -0
- data/test/dummy_rails/app/assets/stylesheets/{application.css.sass → application.sass} +0 -0
- data/test/dummy_rails/app/views/pages/root.html.slim +43 -0
- data/test/dummy_rails/config/application.rb +1 -1
- data/test/dummy_rails/config/environments/development.rb +0 -3
- data/test/dummy_rails/config/environments/production.rb +7 -1
- data/test/dummy_rails/config/environments/test.rb +9 -1
- data/test/dummy_sass_only/Gemfile +1 -1
- data/test/gemfiles/rails_head.gemfile +17 -0
- data/test/node_mincer_test.rb +2 -3
- data/test/node_sass_compile_test.sh +2 -2
- data/test/sprockets_rails_test.rb +1 -1
- data/test/support/reporting.rb +10 -0
- data/test/test_helper.rb +1 -1
- metadata +36 -34
- data/test/dummy_rails/log/development.log +0 -0
- data/test/gemfiles/sass_3_2.gemfile +0 -6
|
@@ -5,7 +5,12 @@ module Bootstrap
|
|
|
5
5
|
%w(stylesheets javascripts fonts images).each do |sub|
|
|
6
6
|
app.config.assets.paths << root.join('assets', sub).to_s
|
|
7
7
|
end
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
# sprockets-rails 3 tracks down the calls to `font_path` and `image_path`
|
|
10
|
+
# and automatically precompiles the referenced assets.
|
|
11
|
+
unless Sprockets::Rails::VERSION.split('.', 2)[0].to_i >= 3
|
|
12
|
+
app.config.assets.precompile << %r(bootstrap/glyphicons-halflings-regular\.(?:eot|svg|ttf|woff2?)$)
|
|
13
|
+
end
|
|
9
14
|
end
|
|
10
15
|
end
|
|
11
16
|
end
|
data/lib/bootstrap-sass.rb
CHANGED
|
@@ -4,7 +4,15 @@ module Bootstrap
|
|
|
4
4
|
# Inspired by Kaminari
|
|
5
5
|
def load!
|
|
6
6
|
register_compass_extension if compass?
|
|
7
|
-
|
|
7
|
+
|
|
8
|
+
if rails?
|
|
9
|
+
register_rails_engine
|
|
10
|
+
elsif lotus?
|
|
11
|
+
register_lotus
|
|
12
|
+
elsif sprockets?
|
|
13
|
+
register_sprockets
|
|
14
|
+
end
|
|
15
|
+
|
|
8
16
|
configure_sass
|
|
9
17
|
end
|
|
10
18
|
|
|
@@ -30,18 +38,22 @@ module Bootstrap
|
|
|
30
38
|
end
|
|
31
39
|
|
|
32
40
|
# Environment detection helpers
|
|
33
|
-
def
|
|
41
|
+
def sprockets?
|
|
34
42
|
defined?(::Sprockets)
|
|
35
43
|
end
|
|
36
44
|
|
|
37
45
|
def compass?
|
|
38
|
-
defined?(::Compass)
|
|
46
|
+
defined?(::Compass::Frameworks)
|
|
39
47
|
end
|
|
40
48
|
|
|
41
49
|
def rails?
|
|
42
50
|
defined?(::Rails)
|
|
43
51
|
end
|
|
44
52
|
|
|
53
|
+
def lotus?
|
|
54
|
+
defined?(::Lotus)
|
|
55
|
+
end
|
|
56
|
+
|
|
45
57
|
private
|
|
46
58
|
|
|
47
59
|
def configure_sass
|
|
@@ -49,8 +61,8 @@ module Bootstrap
|
|
|
49
61
|
|
|
50
62
|
::Sass.load_paths << stylesheets_path
|
|
51
63
|
|
|
52
|
-
# bootstrap requires minimum precision of
|
|
53
|
-
::Sass::Script::Number.precision = [
|
|
64
|
+
# bootstrap requires minimum precision of 8, see https://github.com/twbs/bootstrap-sass/issues/409
|
|
65
|
+
::Sass::Script::Number.precision = [8, ::Sass::Script::Number.precision].max
|
|
54
66
|
end
|
|
55
67
|
|
|
56
68
|
def register_compass_extension
|
|
@@ -66,6 +78,16 @@ module Bootstrap
|
|
|
66
78
|
def register_rails_engine
|
|
67
79
|
require 'bootstrap-sass/engine'
|
|
68
80
|
end
|
|
81
|
+
|
|
82
|
+
def register_lotus
|
|
83
|
+
Lotus::Assets.sources << assets_path
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def register_sprockets
|
|
87
|
+
Sprockets.append_path(stylesheets_path)
|
|
88
|
+
Sprockets.append_path(fonts_path)
|
|
89
|
+
Sprockets.append_path(javascripts_path)
|
|
90
|
+
end
|
|
69
91
|
end
|
|
70
92
|
end
|
|
71
93
|
|
data/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bootstrap-sass",
|
|
3
|
-
"version": "3.3.
|
|
4
|
-
"description": "bootstrap-sass is a Sass-powered version of Bootstrap, ready to drop right into your Sass powered applications.",
|
|
5
|
-
"main": "
|
|
3
|
+
"version": "3.3.6",
|
|
4
|
+
"description": "bootstrap-sass is a Sass-powered version of Bootstrap 3, ready to drop right into your Sass powered applications.",
|
|
5
|
+
"main": "assets/javascripts/bootstrap.js",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "git://github.com/twbs/bootstrap-sass"
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"url": "https://github.com/twbs/bootstrap-sass/issues"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"node-sass": "~
|
|
27
|
-
"mincer": "~1.
|
|
28
|
-
"ejs": "~
|
|
26
|
+
"node-sass": "~3.4.2",
|
|
27
|
+
"mincer": "~1.3",
|
|
28
|
+
"ejs": "~2.3"
|
|
29
29
|
}
|
|
30
30
|
}
|
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
|
}
|
data/tasks/bower.rake
CHANGED
|
@@ -15,16 +15,13 @@ namespace :bower do
|
|
|
15
15
|
require 'bootstrap-sass'
|
|
16
16
|
Dir.chdir Bootstrap.gem_path do
|
|
17
17
|
spec = JSON.parse(File.read 'bower.json')
|
|
18
|
-
js_paths = File.read(File.join Bootstrap.javascripts_path, 'bootstrap-sprockets.js').lines.map do |line|
|
|
19
|
-
line.strip if line.sub!(%r(//\s*=\s*require\s*(?:./)?(.*)\s*), 'assets/javascripts/\1.js')
|
|
20
|
-
end.compact
|
|
21
18
|
|
|
22
19
|
spec['main'] =
|
|
23
20
|
find_files.(File.join(Bootstrap.stylesheets_path, '_bootstrap.scss')) +
|
|
24
21
|
find_files.(Bootstrap.fonts_path) +
|
|
25
|
-
|
|
22
|
+
%w(assets/javascripts/bootstrap.js)
|
|
26
23
|
|
|
27
|
-
spec['version'] = Bootstrap::VERSION
|
|
24
|
+
spec['version'] = Bootstrap::VERSION
|
|
28
25
|
|
|
29
26
|
File.open('bower.json', 'w') do |f|
|
|
30
27
|
f.puts JSON.pretty_generate(spec)
|
|
@@ -12,14 +12,16 @@ class Converter
|
|
|
12
12
|
|
|
13
13
|
log_status 'Updating javascript manifest'
|
|
14
14
|
manifest = ''
|
|
15
|
-
cat = ''
|
|
16
15
|
bootstrap_js_files.each do |name|
|
|
17
|
-
cat << contents[name] + "\n"
|
|
18
16
|
name = name.gsub(/\.js$/, '')
|
|
19
17
|
manifest << "//= require ./bootstrap/#{name}\n"
|
|
20
18
|
end
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
dist_js = read_files('dist/js', %w(bootstrap.js bootstrap.min.js))
|
|
20
|
+
{
|
|
21
|
+
'assets/javascripts/bootstrap-sprockets.js' => manifest,
|
|
22
|
+
'assets/javascripts/bootstrap.js' => dist_js['bootstrap.js'],
|
|
23
|
+
'assets/javascripts/bootstrap.min.js' => dist_js['bootstrap.min.js'],
|
|
24
|
+
}.each do |path, content|
|
|
23
25
|
save_file path, content
|
|
24
26
|
log_processed path
|
|
25
27
|
end
|
|
@@ -27,7 +29,7 @@ class Converter
|
|
|
27
29
|
|
|
28
30
|
def bootstrap_js_files
|
|
29
31
|
@bootstrap_js_files ||= begin
|
|
30
|
-
files = get_paths_by_type
|
|
32
|
+
files = get_paths_by_type('js', /\.js$/).reject { |path| path =~ %r(^tests/) }
|
|
31
33
|
files.sort_by { |f|
|
|
32
34
|
case f
|
|
33
35
|
# tooltip depends on popover and must be loaded earlier
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require_relative 'char_string_scanner'
|
|
2
|
+
require 'bootstrap-sass/version'
|
|
2
3
|
|
|
3
4
|
# This is the script used to automatically convert all of twbs/bootstrap LESS to Sass.
|
|
4
5
|
#
|
|
@@ -95,16 +96,17 @@ class Converter
|
|
|
95
96
|
file = apply_mixin_parent_selector file, '\.(?:visible|hidden)'
|
|
96
97
|
when 'variables.less'
|
|
97
98
|
file = insert_default_vars(file)
|
|
98
|
-
file =
|
|
99
|
-
// When true, asset path helpers are used, otherwise the regular CSS `url()` is used.
|
|
100
|
-
// When there no function is defined, `fn('')` is parsed as string that equals the right hand side
|
|
101
|
-
// NB: in Sass 3.3 there is a native function: function-exists(twbs-font-path)
|
|
102
|
-
$bootstrap-sass-asset-helper: #{sass_fn_exists('twbs-font-path')} !default;
|
|
103
|
-
SCSS
|
|
99
|
+
file = ['$bootstrap-sass-asset-helper: false !default;', file].join("\n")
|
|
104
100
|
file = replace_all file, %r{(\$icon-font-path): \s*"(.*)" (!default);}, "\n" + unindent(<<-SCSS, 14)
|
|
105
|
-
// [converter]
|
|
101
|
+
// [converter] If $bootstrap-sass-asset-helper if used, provide path relative to the assets load path.
|
|
102
|
+
// [converter] This is because some asset helpers, such as Sprockets, do not work with file-relative paths.
|
|
106
103
|
\\1: if($bootstrap-sass-asset-helper, "bootstrap/", "\\2bootstrap/") \\3;
|
|
107
104
|
SCSS
|
|
105
|
+
when 'breadcrumbs.less'
|
|
106
|
+
file = replace_all file, /(.*)(\\00a0)/, unindent(<<-SCSS, 8) + "\\1\#{$nbsp}"
|
|
107
|
+
// [converter] Workaround for https://github.com/sass/libsass/issues/1115
|
|
108
|
+
$nbsp: "\\2";
|
|
109
|
+
SCSS
|
|
108
110
|
when 'close.less'
|
|
109
111
|
# extract .close { button& {...} } rule
|
|
110
112
|
file = extract_nested_rule file, 'button&'
|
|
@@ -114,14 +116,17 @@ class Converter
|
|
|
114
116
|
when 'forms.less'
|
|
115
117
|
file = extract_nested_rule file, 'textarea&'
|
|
116
118
|
file = apply_mixin_parent_selector(file, '\.input-(?:sm|lg)')
|
|
119
|
+
file = replace_rules file, /\.form-group-(?:sm|lg)/ do |rule|
|
|
120
|
+
apply_mixin_parent_selector rule, '.form-control'
|
|
121
|
+
end
|
|
117
122
|
when 'navbar.less'
|
|
118
123
|
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
124
|
when 'tables.less'
|
|
120
125
|
file = replace_all file, /(@include\s*table-row-variant\()(\w+)/, "\\1'\\2'"
|
|
121
|
-
when 'thumbnails.less', 'labels.less', 'badges.less'
|
|
126
|
+
when 'thumbnails.less', 'labels.less', 'badges.less', 'buttons.less'
|
|
122
127
|
file = extract_nested_rule file, 'a&'
|
|
123
128
|
when 'glyphicons.less'
|
|
124
|
-
file = replace_rules(file,
|
|
129
|
+
file = replace_rules(file, /\s*@font-face/) { |rule|
|
|
125
130
|
rule = replace_all rule, /(\$icon-font(?:-\w+)+)/, '#{\1}'
|
|
126
131
|
replace_asset_url rule, :font
|
|
127
132
|
}
|
|
@@ -146,13 +151,11 @@ class Converter
|
|
|
146
151
|
# generate variables template
|
|
147
152
|
save_file 'templates/project/_bootstrap-variables.sass',
|
|
148
153
|
"// Override Bootstrap variables here (defaults from bootstrap-sass v#{Bootstrap::VERSION}):\n\n" +
|
|
149
|
-
File.read("#{save_to}/_variables.scss").gsub(/^(?=\$)/, '// ').gsub(/ !default;/, '')
|
|
154
|
+
File.read("#{save_to}/_variables.scss").lines[1..-1].join.gsub(/^(?=\$)/, '// ').gsub(/ !default;/, '')
|
|
150
155
|
end
|
|
151
156
|
|
|
152
157
|
def bootstrap_less_files
|
|
153
|
-
@bootstrap_less_files ||= get_paths_by_type('less', /\.less$/)
|
|
154
|
-
get_paths_by_type('mixins', /\.less$/,
|
|
155
|
-
get_tree(get_tree_sha('mixins', get_tree(get_tree_sha('less'))))).map { |p| "mixins/#{p}" }
|
|
158
|
+
@bootstrap_less_files ||= get_paths_by_type('less', /\.less$/)
|
|
156
159
|
end
|
|
157
160
|
|
|
158
161
|
# apply general less to scss conversion
|
|
@@ -171,9 +174,16 @@ class Converter
|
|
|
171
174
|
file = deinterpolate_vararg_mixins(file)
|
|
172
175
|
file = replace_calculation_semantics(file)
|
|
173
176
|
file = replace_file_imports(file)
|
|
177
|
+
file = wrap_at_groups_with_at_root(file)
|
|
174
178
|
file
|
|
175
179
|
end
|
|
176
180
|
|
|
181
|
+
def wrap_at_groups_with_at_root(file)
|
|
182
|
+
replace_rules(file, /@(?:font-face|-ms-viewport)/) { |rule, _pos|
|
|
183
|
+
%Q(@at-root {\n#{indent rule, 2}\n})
|
|
184
|
+
}
|
|
185
|
+
end
|
|
186
|
+
|
|
177
187
|
def sass_fn_exists(fn)
|
|
178
188
|
%Q{(#{fn}("") != unquote('#{fn}("")'))}
|
|
179
189
|
end
|
|
@@ -206,7 +216,7 @@ class Converter
|
|
|
206
216
|
SASS
|
|
207
217
|
end
|
|
208
218
|
|
|
209
|
-
# convert grid mixins LESS when =>
|
|
219
|
+
# convert grid mixins LESS when => Sass @if
|
|
210
220
|
def convert_grid_mixins(file)
|
|
211
221
|
file = replace_rules file, /@mixin make-grid-columns/, comments: false do |css, pos|
|
|
212
222
|
mixin_all_grid_columns css, selector: '.col-xs-#{$i}, .col-sm-#{$i}, .col-md-#{$i}, .col-lg-#{$i}', to: '$grid-columns'
|
|
@@ -263,8 +273,8 @@ SASS
|
|
|
263
273
|
|
|
264
274
|
# margin: a -b
|
|
265
275
|
# LESS: sets 2 values
|
|
266
|
-
#
|
|
267
|
-
# This wraps a and -b so they evaluates to 2 values in
|
|
276
|
+
# Sass: sets 1 value (a-b)
|
|
277
|
+
# This wraps a and -b so they evaluates to 2 values in Sass
|
|
268
278
|
def replace_calculation_semantics(file)
|
|
269
279
|
# split_prop_val.call('(@navbar-padding-vertical / 2) -@navbar-padding-horizontal')
|
|
270
280
|
# #=> ["(navbar-padding-vertical / 2)", "-navbar-padding-horizontal"]
|
|
@@ -384,8 +394,10 @@ SASS
|
|
|
384
394
|
end
|
|
385
395
|
# unwrap, and replace @include
|
|
386
396
|
unindent unwrap_rule_block(rule).gsub(/(@include [\w-]+)\(?([\$\w\-,\s]*)\)?/) {
|
|
387
|
-
args = $2
|
|
388
|
-
|
|
397
|
+
name, args = $1, $2
|
|
398
|
+
sel.gsub(/\s+/, ' ').split(/,\s*/ ).map { |sel_part|
|
|
399
|
+
"#{cmt}#{name}('#{sel_part}'#{', ' if args && !args.empty?}#{args})"
|
|
400
|
+
}.join(";\n")
|
|
389
401
|
}
|
|
390
402
|
end
|
|
391
403
|
end
|
|
@@ -424,16 +436,16 @@ SASS
|
|
|
424
436
|
# #scope > .mixin() -> @include scope-mixin()
|
|
425
437
|
# &:extend(.mixin all) -> @include mixin()
|
|
426
438
|
def replace_mixins(less, mixin_names)
|
|
427
|
-
mixin_pattern = /(
|
|
428
|
-
|
|
429
|
-
less = less.gsub(mixin_pattern) do |
|
|
430
|
-
|
|
431
|
-
scope
|
|
432
|
-
|
|
433
|
-
if
|
|
434
|
-
"
|
|
439
|
+
mixin_pattern = /(?<=^|\s)((?:[#|\.][\w-]+\s*>\s*)*)\.([\w-]+)\((.*)\)(?!\s\{)/
|
|
440
|
+
|
|
441
|
+
less = less.gsub(mixin_pattern) do |_|
|
|
442
|
+
scope, name, args = $1, $2, $3
|
|
443
|
+
scope = scope.scan(/[\w-]+/).join('-') + '-' unless scope.empty?
|
|
444
|
+
args = "(#{args.tr(';', ',')})" unless args.empty?
|
|
445
|
+
if name && mixin_names.include?("#{scope}#{name}")
|
|
446
|
+
"@include #{scope}#{name}#{args}"
|
|
435
447
|
else
|
|
436
|
-
"
|
|
448
|
+
"@extend .#{scope}#{name}"
|
|
437
449
|
end
|
|
438
450
|
end
|
|
439
451
|
|
|
@@ -449,7 +461,7 @@ SASS
|
|
|
449
461
|
end
|
|
450
462
|
end
|
|
451
463
|
|
|
452
|
-
# change Microsoft filters to
|
|
464
|
+
# change Microsoft filters to Sass calling convention
|
|
453
465
|
def replace_ms_filters(file)
|
|
454
466
|
log_transform
|
|
455
467
|
file.gsub(
|
|
@@ -497,7 +509,7 @@ SASS
|
|
|
497
509
|
end
|
|
498
510
|
|
|
499
511
|
def replace_escaping(less)
|
|
500
|
-
less = less.gsub(/~"([^"]+)"/, '
|
|
512
|
+
less = less.gsub(/~"([^"]+)"/, '\1').gsub(/~'([^']+)'/, '\1') # Get rid of ~"" escape
|
|
501
513
|
less.gsub!(/\$\{([^}]+)\}/, '$\1') # Get rid of @{} escape
|
|
502
514
|
less.gsub!(/"([^"\n]*)(\$[\w\-]+)([^"\n]*)"/, '"\1#{\2}\3"') # interpolate variable in string, e.g. url("$file-1x") => url("#{$file-1x}")
|
|
503
515
|
less.gsub(/(\W)e\(%\("?([^"]*)"?\)\)/, '\1\2') # Get rid of e(%("")) escape
|
data/tasks/converter/network.rb
CHANGED
|
@@ -3,8 +3,12 @@ class Converter
|
|
|
3
3
|
module Network
|
|
4
4
|
protected
|
|
5
5
|
|
|
6
|
-
def get_paths_by_type(dir, file_re,
|
|
7
|
-
|
|
6
|
+
def get_paths_by_type(dir, file_re, recursive = true)
|
|
7
|
+
get_file_paths(dir, recursive).select { |path| path =~ file_re }
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def get_file_paths(dir, recursive = true)
|
|
11
|
+
get_tree(get_tree_sha(dir), recursive)['tree'].select { |f| f['type'] == 'blob' }.map { |f| f['path'] }
|
|
8
12
|
end
|
|
9
13
|
|
|
10
14
|
def read_files(path, files)
|
|
@@ -44,7 +48,8 @@ class Converter
|
|
|
44
48
|
|
|
45
49
|
|
|
46
50
|
def get_file(url)
|
|
47
|
-
|
|
51
|
+
uri = URI(url)
|
|
52
|
+
cache_path = "./#@cache_path#{uri.path}#{uri.query.tr('?&=', '-') if uri.query}"
|
|
48
53
|
FileUtils.mkdir_p File.dirname(cache_path)
|
|
49
54
|
if File.exists?(cache_path)
|
|
50
55
|
log_http_get_file url, true
|
|
@@ -81,8 +86,8 @@ class Converter
|
|
|
81
86
|
@trees ||= get_tree(@branch_sha)
|
|
82
87
|
end
|
|
83
88
|
|
|
84
|
-
def get_tree(sha)
|
|
85
|
-
get_json("https://api.github.com/repos/#@repo/git/trees/#{sha}")
|
|
89
|
+
def get_tree(sha, recursive = true)
|
|
90
|
+
get_json("https://api.github.com/repos/#@repo/git/trees/#{sha}#{'?recursive=1' if recursive}")
|
|
86
91
|
end
|
|
87
92
|
|
|
88
93
|
def get_json(url)
|
data/tasks/converter.rb
CHANGED
|
@@ -50,7 +50,7 @@ class Converter
|
|
|
50
50
|
def_delegators :@logger, :log, :log_status, :log_processing, :log_transform, :log_file_info, :log_processed, :log_http_get_file, :log_http_get_files, :silence_log
|
|
51
51
|
|
|
52
52
|
def process_bootstrap
|
|
53
|
-
log_status "Convert Bootstrap LESS to
|
|
53
|
+
log_status "Convert Bootstrap LESS to Sass"
|
|
54
54
|
puts " repo : #@repo_url"
|
|
55
55
|
puts " branch : #@branch_sha #@repo_url/tree/#@branch"
|
|
56
56
|
puts " save to: #{@save_to.to_json}"
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
// Override Bootstrap variables here (defaults from bootstrap-sass v3.3.
|
|
2
|
-
|
|
3
|
-
// When true, asset path helpers are used, otherwise the regular CSS `url()` is used.
|
|
4
|
-
// When there no function is defined, `fn('')` is parsed as string that equals the right hand side
|
|
5
|
-
// NB: in Sass 3.3 there is a native function: function-exists(twbs-font-path)
|
|
6
|
-
// $bootstrap-sass-asset-helper: (twbs-font-path("") != unquote('twbs-font-path("")'))
|
|
1
|
+
// Override Bootstrap variables here (defaults from bootstrap-sass v3.3.6):
|
|
7
2
|
|
|
8
3
|
//
|
|
9
4
|
// Variables
|
|
@@ -21,7 +16,7 @@
|
|
|
21
16
|
// $gray-light: lighten($gray-base, 46.7%) // #777
|
|
22
17
|
// $gray-lighter: lighten($gray-base, 93.5%) // #eee
|
|
23
18
|
|
|
24
|
-
// $brand-primary: darken(#428bca, 6.5%)
|
|
19
|
+
// $brand-primary: darken(#428bca, 6.5%) // #337ab7
|
|
25
20
|
// $brand-success: #5cb85c
|
|
26
21
|
// $brand-info: #5bc0de
|
|
27
22
|
// $brand-warning: #f0ad4e
|
|
@@ -84,7 +79,8 @@
|
|
|
84
79
|
|
|
85
80
|
//** Load fonts from this directory.
|
|
86
81
|
|
|
87
|
-
// [converter]
|
|
82
|
+
// [converter] If $bootstrap-sass-asset-helper if used, provide path relative to the assets load path.
|
|
83
|
+
// [converter] This is because some asset helpers, such as Sprockets, do not work with file-relative paths.
|
|
88
84
|
// $icon-font-path: if($bootstrap-sass-asset-helper, "bootstrap/", "../fonts/bootstrap/")
|
|
89
85
|
|
|
90
86
|
//** File name for all font files.
|
|
@@ -109,7 +105,7 @@
|
|
|
109
105
|
// $padding-xs-vertical: 1px
|
|
110
106
|
// $padding-xs-horizontal: 5px
|
|
111
107
|
|
|
112
|
-
// $line-height-large: 1.
|
|
108
|
+
// $line-height-large: 1.3333333 // extra decimals for Win 8.1 Chrome
|
|
113
109
|
// $line-height-small: 1.5
|
|
114
110
|
|
|
115
111
|
// $border-radius-base: 4px
|
|
@@ -180,6 +176,11 @@
|
|
|
180
176
|
|
|
181
177
|
// $btn-link-disabled-color: $gray-light
|
|
182
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
|
+
|
|
183
184
|
|
|
184
185
|
//== Forms
|
|
185
186
|
//
|
|
@@ -197,6 +198,7 @@
|
|
|
197
198
|
|
|
198
199
|
// TODO: Rename `$input-border-radius` to `$input-border-radius-base` in v4
|
|
199
200
|
//** Default `.form-control` border radius
|
|
201
|
+
// This has no effect on `<select>`s in some browsers, due to the limited stylability of `<select>`s in CSS.
|
|
200
202
|
// $input-border-radius: $border-radius-base
|
|
201
203
|
//** Large `.form-control` border radius
|
|
202
204
|
// $input-border-radius-large: $border-radius-large
|
|
@@ -216,6 +218,9 @@
|
|
|
216
218
|
//** Small `.form-control` height
|
|
217
219
|
// $input-height-small: (floor($font-size-small * $line-height-small) + ($padding-small-vertical * 2) + 2)
|
|
218
220
|
|
|
221
|
+
//** `.form-group` margin
|
|
222
|
+
// $form-group-margin-bottom: 15px
|
|
223
|
+
|
|
219
224
|
// $legend-color: $gray-dark
|
|
220
225
|
// $legend-border-color: #e5e5e5
|
|
221
226
|
|
|
@@ -275,7 +280,8 @@
|
|
|
275
280
|
// $zindex-popover: 1060
|
|
276
281
|
// $zindex-tooltip: 1070
|
|
277
282
|
// $zindex-navbar-fixed: 1030
|
|
278
|
-
// $zindex-modal:
|
|
283
|
+
// $zindex-modal-background: 1040
|
|
284
|
+
// $zindex-modal: 1050
|
|
279
285
|
|
|
280
286
|
|
|
281
287
|
//== Media queries breakpoints
|
|
@@ -388,7 +394,7 @@
|
|
|
388
394
|
// $navbar-default-toggle-border-color: #ddd
|
|
389
395
|
|
|
390
396
|
|
|
391
|
-
|
|
397
|
+
//=== Inverted navbar
|
|
392
398
|
// Reset inverted navbar basics
|
|
393
399
|
// $navbar-inverse-color: lighten($gray-light, 15%)
|
|
394
400
|
// $navbar-inverse-bg: #222
|
|
@@ -489,6 +495,7 @@
|
|
|
489
495
|
// $jumbotron-bg: $gray-lighter
|
|
490
496
|
// $jumbotron-heading-color: inherit
|
|
491
497
|
// $jumbotron-font-size: ceil(($font-size-base * 1.5))
|
|
498
|
+
// $jumbotron-heading-font-size: ceil(($font-size-base * 4.5))
|
|
492
499
|
|
|
493
500
|
|
|
494
501
|
//== Form states and alerts
|
|
@@ -862,5 +869,7 @@
|
|
|
862
869
|
// $page-header-border-color: $gray-lighter
|
|
863
870
|
//** Width of horizontal description list titles
|
|
864
871
|
// $dl-horizontal-offset: $component-offset-horizontal
|
|
872
|
+
//** Point at which .dl-horizontal becomes horizontal
|
|
873
|
+
// $dl-horizontal-breakpoint: $grid-float-breakpoint
|
|
865
874
|
//** Horizontal line color.
|
|
866
875
|
// $hr-border: $gray-lighter
|
|
File without changes
|
|
@@ -1,3 +1,46 @@
|
|
|
1
|
+
.navbar.navbar-inverse: .container-fluid
|
|
2
|
+
.navbar-header
|
|
3
|
+
button.navbar-toggle.collapsed type="button" data-toggle="collapse" data-target="#c1"
|
|
4
|
+
span.sr-only Toggle navigation
|
|
5
|
+
span.icon-bar
|
|
6
|
+
span.icon-bar
|
|
7
|
+
span.icon-bar
|
|
8
|
+
a.navbar-brand href="#" Bootstrap for Sass Test Rails App
|
|
9
|
+
.collapse.navbar-collapse#c1
|
|
10
|
+
ul.nav.navbar-nav
|
|
11
|
+
li.active: a href="#"
|
|
12
|
+
' Home
|
|
13
|
+
span.sr-only (current)
|
|
14
|
+
li: a href="#" Link
|
|
15
|
+
li.dropdown
|
|
16
|
+
a.dropdown-toggle href="#" data-toggle="dropdown" role="button" aria-expanded="false"
|
|
17
|
+
' Dropdown
|
|
18
|
+
span.caret
|
|
19
|
+
ul.dropdown-menu role="menu"
|
|
20
|
+
li: a href="#" Action
|
|
21
|
+
li: a href="#" Another action
|
|
22
|
+
li: a href="#" Something else here
|
|
23
|
+
li.divider
|
|
24
|
+
li: a href="#" Separated link
|
|
25
|
+
li.divider
|
|
26
|
+
li: a href="#" One more separated link
|
|
27
|
+
form.navbar-form.navbar-left role="search"
|
|
28
|
+
.input-group
|
|
29
|
+
input.form-control type="search" placeholder="Search..."
|
|
30
|
+
.input-group-btn: button.btn.btn-primary type="submit" Go
|
|
31
|
+
ul.nav.navbar-nav.navbar-right
|
|
32
|
+
li: a href="#" Link
|
|
33
|
+
li.dropdown
|
|
34
|
+
a.dropdown-toggle href="#" data-toggle="dropdown" role="button" aria-expanded="false"
|
|
35
|
+
' Dropdown
|
|
36
|
+
span.caret
|
|
37
|
+
ul.dropdown-menu role="menu"
|
|
38
|
+
li: a href="#" Action
|
|
39
|
+
li: a href="#" Another action
|
|
40
|
+
li: a href="#" Something else here
|
|
41
|
+
li.divider
|
|
42
|
+
li: a href="#" Separated link
|
|
43
|
+
|
|
1
44
|
.container
|
|
2
45
|
.panel.panel-primary
|
|
3
46
|
.panel-heading: h1 Dummy App
|
|
@@ -12,13 +12,13 @@ end
|
|
|
12
12
|
|
|
13
13
|
require 'slim-rails'
|
|
14
14
|
require 'jquery-rails'
|
|
15
|
-
require 'compass'
|
|
16
15
|
require 'bootstrap-sass'
|
|
17
16
|
require 'uglifier'
|
|
18
17
|
|
|
19
18
|
module Dummy
|
|
20
19
|
class Application < Rails::Application
|
|
21
20
|
config.assets.enabled = true if config.assets.respond_to?(:enabled)
|
|
21
|
+
config.assets.precompile += %w( application.css application.js )
|
|
22
22
|
config.to_prepare do
|
|
23
23
|
if ENV['VERBOSE']
|
|
24
24
|
STDERR.puts "Loaded Rails #{Rails::VERSION::STRING}, Sprockets #{Sprockets::VERSION}",
|
|
@@ -16,9 +16,6 @@ Dummy::Application.configure do
|
|
|
16
16
|
# Print deprecation notices to the Rails logger.
|
|
17
17
|
config.active_support.deprecation = :log
|
|
18
18
|
|
|
19
|
-
# Raise an error on page load if there are pending migrations
|
|
20
|
-
config.active_record.migration_error = :page_load
|
|
21
|
-
|
|
22
19
|
# Debug mode disables concatenation and preprocessing of assets.
|
|
23
20
|
# This option may cause significant delays in view rendering with a large
|
|
24
21
|
# number of complex assets.
|
|
@@ -20,7 +20,13 @@ Dummy::Application.configure do
|
|
|
20
20
|
# config.action_dispatch.rack_cache = true
|
|
21
21
|
|
|
22
22
|
# Disable Rails's static asset server (Apache or nginx will already do this).
|
|
23
|
-
config.
|
|
23
|
+
if config.respond_to?(:serve_static_files)
|
|
24
|
+
# rails >= 4.2
|
|
25
|
+
config.serve_static_files = true
|
|
26
|
+
elsif config.respond_to?(:serve_static_assets)
|
|
27
|
+
# rails < 4.2
|
|
28
|
+
config.serve_static_assets = true
|
|
29
|
+
end
|
|
24
30
|
|
|
25
31
|
# Compress JavaScripts and CSS.
|
|
26
32
|
config.assets.js_compressor = :uglifier
|
|
@@ -13,7 +13,13 @@ Dummy::Application.configure do
|
|
|
13
13
|
config.eager_load = false
|
|
14
14
|
|
|
15
15
|
# Configure static asset server for tests with Cache-Control for performance.
|
|
16
|
-
config.
|
|
16
|
+
if config.respond_to?(:serve_static_files)
|
|
17
|
+
# rails >= 4.2
|
|
18
|
+
config.serve_static_files = true
|
|
19
|
+
elsif config.respond_to?(:serve_static_assets)
|
|
20
|
+
# rails < 4.2
|
|
21
|
+
config.serve_static_assets = true
|
|
22
|
+
end
|
|
17
23
|
config.static_cache_control = "public, max-age=3600"
|
|
18
24
|
|
|
19
25
|
# Show full error reports and disable caching.
|
|
@@ -26,5 +32,7 @@ Dummy::Application.configure do
|
|
|
26
32
|
# Disable request forgery protection in test environment.
|
|
27
33
|
config.action_controller.allow_forgery_protection = false
|
|
28
34
|
|
|
35
|
+
config.active_support.test_order = :random
|
|
36
|
+
|
|
29
37
|
config.active_support.deprecation = :stderr
|
|
30
38
|
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
source "https://rubygems.org"
|
|
2
|
+
|
|
3
|
+
gem 'actionpack', github: 'rails/rails'
|
|
4
|
+
gem 'activesupport', github: 'rails/rails'
|
|
5
|
+
|
|
6
|
+
# Required git dependencies as per https://github.com/rails/rails/blob/51211a94bd7a34d80f2412a7f94fefe7366647a5/Gemfile:
|
|
7
|
+
gem 'rack', github: 'rack/rack'
|
|
8
|
+
gem 'sprockets', github: 'rails/sprockets'
|
|
9
|
+
gem 'sprockets-rails', github: 'rails/sprockets-rails'
|
|
10
|
+
gem 'sass-rails', github: 'rails/sass-rails', branch: 'master'
|
|
11
|
+
|
|
12
|
+
gem 'autoprefixer-rails', github: 'ai/autoprefixer-rails'
|
|
13
|
+
|
|
14
|
+
gem 'compass', '~> 1.0.1', require: false
|
|
15
|
+
|
|
16
|
+
gemspec path: '../../'
|
|
17
|
+
|