Skip to content

Commit 805c2d9

Browse files
committed
dart-sass 1.99.0 (new formula)
1 parent 63286c1 commit 805c2d9

1 file changed

Lines changed: 62 additions & 0 deletions

File tree

Formula/d/dart-sass.rb

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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-vesrion=#{Formula["dart-sdk"].version}
31+
-Dcompiler-version=#{version}
32+
-Dprotocol-version=#{resource("language").version}
33+
]
34+
args << "-DMACOSX_DEPLOYMENT_TARGET=#{MacOS.version}" if OS.mac?
35+
36+
system "dart", "compile", "aot-snapshot", "--output", "sass.aot", *args, "bin/sass.dart"
37+
libexec.install "sass.aot"
38+
39+
(bin/"sass").write <<~BASH
40+
#!/bin/bash
41+
exec "#{Formula["dartaotruntime"].opt_bin}/dartaotruntime" "#{libexec}/sass.aot" "$@"
42+
BASH
43+
end
44+
45+
test do
46+
assert_match version.to_s, shell_output("#{bin}/sass --version")
47+
48+
(testpath/"test.scss").write(".class {property: 1 + 1}")
49+
assert_match "property: 2;", shell_output("#{bin}/sass test.scss 2>&1")
50+
51+
(testpath/"input.scss").write <<~EOS
52+
div {
53+
img {
54+
border: 0px;
55+
}
56+
}
57+
EOS
58+
59+
assert_equal "div img{border:0px}",
60+
shell_output("#{bin}/sass --style compressed input.scss").strip
61+
end
62+
end

0 commit comments

Comments
 (0)