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