Skip to content

Commit c075650

Browse files
committed
dart-sass 1.99.0 (new formula)
1 parent e3340af commit c075650

1 file changed

Lines changed: 60 additions & 0 deletions

File tree

Formula/d/dart-sass.rb

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
class DartSass < Formula
2+
desc "Reference implementation of Sass, written in Dart"
3+
homepage "https://sass-lang.com/dart-sass"
4+
url "https://github.com/sass/dart-sass/archive/refs/tags/1.99.0.tar.gz"
5+
sha256 "5f969b2eedf86384d90a9a339824b6652a4600e9e5f32784a7e48e453e145016"
6+
license "MIT"
7+
8+
depends_on "buf" => :build
9+
depends_on "dart-sdk" => :build
10+
depends_on "dartaotruntime"
11+
12+
resource "language" do
13+
url "https://github.com/sass/sass/archive/refs/tags/embedded-protocol-3.2.0.tar.gz"
14+
sha256 "4e1f81684bc1666f03e52ddc790d0c2c22d99a5313fa2efe1dde4a5b5733c186"
15+
end
16+
17+
def install
18+
ENV["PUB_ENVIRONMENT"] = "homebrew:sass"
19+
ENV["DART_SUPPRESS_ANALYTICS"] = "true"
20+
21+
(buildpath/"build/language").install resource("language")
22+
23+
system "dart", "pub", "get"
24+
with_env(UPDATE_SASS_PROTOCOL: "false") do
25+
system "dart", "run", "grinder", "protobuf"
26+
end
27+
28+
args = %W[
29+
-Dversion=#{version}
30+
-Ddart-version=#{Formula["dart-sdk"].version}
31+
-Dcompiler-version=#{version}
32+
-Dprotocol-version=#{resource("language").version}
33+
]
34+
system "dart", "compile", "aot-snapshot", "--output", "sass.aot", *args, "bin/sass.dart"
35+
libexec.install "sass.aot"
36+
37+
(bin/"sass").write <<~BASH
38+
#!/bin/bash
39+
exec "#{Formula["dartaotruntime"].opt_bin}/dartaotruntime" "#{libexec}/sass.aot" "$@"
40+
BASH
41+
end
42+
43+
test do
44+
assert_match version.to_s, shell_output("#{bin}/sass --version")
45+
46+
(testpath/"test.scss").write(".class {property: 1 + 1}")
47+
assert_match "property: 2;", shell_output("#{bin}/sass test.scss 2>&1")
48+
49+
(testpath/"input.scss").write <<~EOS
50+
div {
51+
img {
52+
border: 0px;
53+
}
54+
}
55+
EOS
56+
57+
assert_equal "div img{border:0px}",
58+
shell_output("#{bin}/sass --style compressed input.scss").strip
59+
end
60+
end

0 commit comments

Comments
 (0)