Skip to content

Commit

Permalink
add more interpolation
Browse files Browse the repository at this point in the history
  • Loading branch information
braver committed Feb 4, 2024
1 parent fa3d66e commit 25fe41b
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Syntaxes/SCSS.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ contexts:
- include: scss-default-operators
- include: scss-global-operators

at-keyframe-identifier:
- meta_prepend: true
- include: scss-interpolation

###[ SCSS DEFAULT/GLOBAL VALUES ]###############################################

scss-default-operators:
Expand Down
35 changes: 34 additions & 1 deletion Tests/syntax_test_scss.scss
Original file line number Diff line number Diff line change
Expand Up @@ -366,11 +366,44 @@ code {
// Shadowing (Global Values)
// https://sass-lang.com/documentation/variables/#shadowing
//=============================================================================

$variable: first global value;

.content {
$variable: second global value !global;
// ^^^^^^^ keyword.other.global.scss
value: $variable;
}

//=============================================================================
// Interpolation
// https://sass-lang.com/documentation/interpolation/
//=============================================================================
@mixin corner-icon($name, $top-or-bottom, $left-or-right) {
.icon-#{$name} {
background-image: url("/icons/#{$name}.svg");
// ^^^^^^^^ meta.interpolation.scss
position: absolute;
#{$top-or-bottom}: 0;
// ^^^^^^^^^^^^^^^^^ meta.interpolation.scss
#{$left-or-right}: 0;
// ^^^^^^^^^^^^^^^^^ meta.interpolation.scss
}
}

@mixin inline-animation($duration) {
$name: inline-#{unique-id()};
// ^^^^^^^^^^^^^^ meta.interpolation.scss

// FYI: meta.at-rule.keyframe.css does not apply to the interpolated bit due to clear_scopes
@keyframes #{$name} {
// ^^^^^^^^^^ meta.at-rule.keyframe.css
// ^ meta.at-rule.keyframe.css
// ^^^^^^^^^ keyword.control.directive.css
// ^^^^^^^^ meta.interpolation.scss
@content;
}

animation-name: $name;
animation-duration: $duration;
animation-iteration-count: infinite;
}

0 comments on commit 25fe41b

Please sign in to comment.