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

fix layer and container in scss #371

Merged
merged 1 commit into from
Nov 13, 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
5 changes: 2 additions & 3 deletions src/parser/cssParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -950,11 +950,10 @@ export class Parser {

public _parseLayerName(): nodes.Node | null {
// <layer-name> = <ident> [ '.' <ident> ]*
if (!this.peek(TokenType.Ident)) {
const node = this.createNode(nodes.NodeType.LayerName);
if (!node.addChild(this._parseIdent()) ) {
return null;
}
const node = this.createNode(nodes.NodeType.LayerName);
node.addChild(this._parseIdent());
while (!this.hasWhitespace() && this.acceptDelim('.')) {
if (this.hasWhitespace() || !node.addChild(this._parseIdent())) {
return this.finish(node, ParseError.IdentifierExpected);
Expand Down
4 changes: 2 additions & 2 deletions src/parser/cssScanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ export enum TokenType {
Comment,
SingleLineComment,
EOF,
CustomToken,
ContainerQueryLength
ContainerQueryLength,
CustomToken // must be last token type
}

export interface IToken {
Expand Down
10 changes: 10 additions & 0 deletions src/test/scss/parser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,16 @@ suite('SCSS - Parser', () => {
assertNode('@import url("override.css") layer;', parser, parser._parseStylesheet.bind(parser));
});

test('@layer', function () {
const parser = new SCSSParser();
assertNode('@layer #{$layer} { }', parser, parser._parseLayer.bind(parser));
});

test('@container', function () {
const parser = new SCSSParser();
assertNode(`@container (min-width: #{$minWidth}) { .scss-interpolation { line-height: 10cqh; } }`, parser, parser._parseStylesheet.bind(parser));
});

test('@use', function () {
const parser = new SCSSParser();
assertNode('@use "test"', parser, parser._parseUse.bind(parser));
Expand Down
Loading