Skip to content

Commit 1c8d397

Browse files
author
Tim van der Horst
committed
Add !default suffix to all Sass variables
1 parent 844ac42 commit 1c8d397

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

build/lessToSass.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,10 @@ function convertVariables(line) {
6969
// Matches any @ that doesn't have 'media ' or 'import ' after it.
7070
var atRegex = /@(?!(media|import|mixin|font-face|keyframes)(\s|\())/g;
7171

72-
return line.replace(atRegex, '$');
72+
// Matches any Sass variable line
73+
var variableRegex = /^(\$[\w\d-_]+:\s*(.(?!\!default))+);(.*)$/gm;
74+
75+
return line.replace(atRegex, '$$').replace(variableRegex, '$1 !default;$3');
7376
}
7477

7578
function convertFileExtensions(line) {

0 commit comments

Comments
 (0)