Skip to content

Commit 2579e33

Browse files
committed
wrap at-groups with @at-root twbs#805
1 parent f95e617 commit 2579e33

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tasks/converter/less_conversion.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def process_stylesheet_assets
121121
when 'thumbnails.less', 'labels.less', 'badges.less', 'buttons.less'
122122
file = extract_nested_rule file, 'a&'
123123
when 'glyphicons.less'
124-
file = replace_rules(file, '@font-face') { |rule|
124+
file = replace_rules(file, /\s*@font-face/) { |rule|
125125
rule = replace_all rule, /(\$icon-font(?:-\w+)+)/, '#{\1}'
126126
replace_asset_url rule, :font
127127
}
@@ -169,9 +169,16 @@ def convert_to_scss(file)
169169
file = deinterpolate_vararg_mixins(file)
170170
file = replace_calculation_semantics(file)
171171
file = replace_file_imports(file)
172+
file = wrap_at_groups_with_at_root(file)
172173
file
173174
end
174175

176+
def wrap_at_groups_with_at_root(file)
177+
replace_rules(file, /@(?:font-face|-ms-viewport)/) { |rule, _pos|
178+
%Q(@at-root {\n#{indent rule, 2}\n})
179+
}
180+
end
181+
175182
def sass_fn_exists(fn)
176183
%Q{(#{fn}("") != unquote('#{fn}("")'))}
177184
end

0 commit comments

Comments
 (0)