-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: generate angular-ngc sass_binary targets with aspect configure …
…plugin (#413) * chore: upgrade aspect-cli to 2025.08.18 * feat: generate angular-ngc sass_binary targets with aspect configure plugin
- Loading branch information
Showing
8 changed files
with
60 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
configure: | ||
languages: | ||
javascript: true | ||
plugins: | ||
- .aspect/cli/postcss.star |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
aspect.register_rule_kind("sass_binary", { | ||
"From": "//tools:sass.bzl", | ||
"MergeableAttrs": ["srcs"], | ||
"ResolveAttrs": ["deps"], | ||
}) | ||
|
||
def declare_postcss(ctx): | ||
if len(ctx.sources) == 0: | ||
ctx.targets.remove("css") | ||
return | ||
|
||
imports = [] | ||
for file in ctx.sources: | ||
imports.extend([ | ||
aspect.Import( | ||
id = i.captures["import"], | ||
provider = "js", | ||
src = file.path, | ||
) | ||
for i in file.query_results["imports"] | ||
]) | ||
|
||
ctx.targets.add( | ||
name = "css", | ||
kind = "sass_binary", | ||
attrs = { | ||
"srcs": [src.path for src in ctx.sources], | ||
"deps": imports, | ||
}, | ||
) | ||
|
||
aspect.register_configure_extension( | ||
id = "postcss", | ||
prepare = lambda _: aspect.PrepareResult( | ||
sources = [ | ||
aspect.SourceExtensions(".scss"), | ||
], | ||
queries = { | ||
"imports": aspect.RegexQuery( | ||
filter = "**/*.scss", | ||
expression = """@use\\s+['"](?P<import>[^'"]+)['"]""", | ||
), | ||
}, | ||
), | ||
declare = declare_postcss, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters