Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added css & scss queries #244

Merged
merged 7 commits into from
Apr 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ use 'nvim-treesitter/nvim-treesitter-context'
- [ ] `commonlisp`
- [ ] `cooklang`
- [ ] `cpon`
- [ ] `css`
- [x] `css`
- [ ] `cuda`
- [ ] `d`
- [ ] `devicetree`
Expand Down Expand Up @@ -158,7 +158,7 @@ use 'nvim-treesitter/nvim-treesitter-context'
- [ ] `ron`
- [ ] `rst`
- [ ] `scheme`
- [ ] `scss`
- [x] `scss`
- [ ] `slint`
- [ ] `smali`
- [ ] `smithy`
Expand Down
10 changes: 10 additions & 0 deletions queries/css/context.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
(rule_set) @context
([
(rule_set)
(keyframe_block)
(keyframes_statement)
(media_statement)
(supports_statement)
(at_rule)
] @context)

13 changes: 13 additions & 0 deletions queries/scss/context.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
; inherits: css

([
(mixin_statement)
(function_statement)
(each_statement)
(for_statement)
(while_statement)
(if_clause)
(else_if_clause)
(else_clause)
] @context)

112 changes: 112 additions & 0 deletions test/test.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
.foo {
background-color: #fff;
color: #000;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;


font-size: 14px;


@supports (font-size: calc(1vw + 1vh + 1vmin)) {



font-size: calc(1vw + 1vh + 1vmin);







}

@color-profile --swop5c {



src: url("https://example.org/SWOP2006_Coated5v2.icc");








}








line-height: 1.42857143;
}

@keyframes wave {
0% {
transform: translateY(-50%) scale(0);
opacity: 0;








}
50% {



transform: translateY(-50%) scale(1);
opacity: 1;
}
100% {
transform: translateY(-50%) scale(0);



opacity: 0;
}
}

@media (prefers-reduced-motion: reduce) {



*,
*::before,
*::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
scroll-behavior: auto !important;
}













}









233 changes: 233 additions & 0 deletions test/test.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,233 @@
$sizes: 40px, 50px, 80px;

.foo-container {
.foo-item {
color: red;





}
.foo-image {
width: 100%;
height: 100%;






}
}

@each $size in $sizes {
.foo-#{$size} {




width: $size;





height: $size;
}
}

@for $i from 1 through 3 {




.foo-#{$i} {



width: $i * 10px;





}




}

@while $i < 10 {











}

@keyframes FooKeyframes {
0% {






transform: rotateX(60deg) rotateZ(-45deg) scale(1);
filter: blur(5px);
}

50% {







transform: rotateX(60deg) rotateZ(-225deg) scale(1.1);
filter: blur(15px);
}

100% {
transform: rotateX(60deg) rotateZ(-405deg) scale(1);
filter: blur(5px);







}
}

@media (prefers-reduced-motion: reduce) {



*,
*::before,
*::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
scroll-behavior: auto !important;
}













}

@mixin FooMixin($a, $b) {

@if $a > $b {
color: red;









} @else if $a < $b {
color: blue;







} @else {




color: green;





}














}



@function add($a, $b) {







@return $a + $b;






}

@at-root {





color: red;




}