Skip to content

Commit

Permalink
handle math.div
Browse files Browse the repository at this point in the history
  • Loading branch information
AprilArcus committed Feb 22, 2022
1 parent b34765d commit 3c90d07
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tasks/converter/less_conversion.rb
Expand Up @@ -173,6 +173,7 @@ def convert_to_scss(file)
file = replace_calculation_semantics(file)
file = replace_file_imports(file)
file = wrap_at_groups_with_at_root(file)
file = replace_division(file)
file
end

Expand All @@ -182,6 +183,12 @@ def wrap_at_groups_with_at_root(file)
}
end

def replace_division(less)
re = /(?<!\w)\(\s*([^(]+?)\s+\/\s+([^)]+?)\s*\)/
return less if less !~ re
"@use \"sass:math\";\n" + less.gsub(re, 'math.div(\1, \2)')
end

def sass_fn_exists(fn)
%Q{(#{fn}("") != unquote('#{fn}("")'))}
end
Expand Down

0 comments on commit 3c90d07

Please sign in to comment.