dartsass-rails 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +4 -1
- data/exe/aarch64-linux/sass +0 -0
- data/exe/arm64-darwin/sass +0 -0
- data/exe/dartsass +9 -6
- data/lib/dartsass/version.rb +1 -1
- data/lib/install/dartsass.rb +7 -0
- data/lib/tasks/build.rake +8 -4
- data/lib/tasks/clobber.rake +1 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2bb5dbbe961c634d409fb2970b7f38bdc3ada499464fbd3f6b08e7611912601a
|
4
|
+
data.tar.gz: 37d5f1fedc4776681e06f644d78e1ec0535d4d64f7cd69bc94ad268fcdb35d88
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7dd747bdab7faf6c76ec493d0dc31ea328a7841710402d6d2570fc078903417eb57be0d29e97cbf3018d84723acbdf68f31a2abf1cf6ca606e9de09a690e11c
|
7
|
+
data.tar.gz: a388121bf37cd4e00928b7b47425bc782b61d46fd9f422f7bda9abadb874527ca6eaf59ade8514e3247b156b719ea7e10dc0b5cc3baae297a5e34ad3cd060f72
|
data/README.md
CHANGED
@@ -34,7 +34,10 @@ Rails.application.config.dartsass.builds = {
|
|
34
34
|
}
|
35
35
|
```
|
36
36
|
|
37
|
-
The
|
37
|
+
The hash key is the relative path to a Sass file in `app/assets/stylesheets/` and the hash value will be the name of the file output to `app/assets/builds/`.
|
38
|
+
|
39
|
+
## Importing assets from gems
|
40
|
+
`dartsass:build` includes application [assets paths](https://guides.rubyonrails.org/asset_pipeline.html#search-paths) as Sass [load paths](https://sass-lang.com/documentation/at-rules/use#load-paths). Assuming the gem has made assets visible to the Rails application, no additional configuration is required to use them.
|
38
41
|
|
39
42
|
|
40
43
|
## Version
|
Binary file
|
Binary file
|
data/exe/dartsass
CHANGED
@@ -3,16 +3,19 @@
|
|
3
3
|
|
4
4
|
require "shellwords"
|
5
5
|
|
6
|
-
|
6
|
+
platform_info = Gem::Platform.local
|
7
|
+
platform_string = "#{platform_info.cpu}-#{platform_info.os}"
|
7
8
|
|
8
9
|
exe_path =
|
9
|
-
case
|
10
|
-
when "
|
11
|
-
when "
|
12
|
-
when
|
10
|
+
case platform_string
|
11
|
+
when "aarch64-linux" then File.join(__dir__, "aarch64-linux/sass")
|
12
|
+
when "arm64-darwin" then File.join(__dir__, "arm64-darwin/sass")
|
13
|
+
when /darwin\z/ then File.join(__dir__, "darwin/sass")
|
14
|
+
when /linux\z/ then File.join(__dir__, "linux/sass")
|
15
|
+
when /mingw32\z/ then File.join(__dir__, "mingw32/sass.bat")
|
13
16
|
else
|
14
17
|
STDERR.puts(<<~ERRMSG)
|
15
|
-
ERROR: dartsass-rails does not support the #{
|
18
|
+
ERROR: dartsass-rails does not support the #{platform_string} platform
|
16
19
|
ERRMSG
|
17
20
|
exit 1
|
18
21
|
end
|
data/lib/dartsass/version.rb
CHANGED
data/lib/install/dartsass.rb
CHANGED
@@ -5,6 +5,13 @@ say "Build into app/assets/builds"
|
|
5
5
|
empty_directory "app/assets/builds"
|
6
6
|
keep_file "app/assets/builds"
|
7
7
|
|
8
|
+
if (sprockets_manifest_path = Rails.root.join("app/assets/config/manifest.js")).exist?
|
9
|
+
append_to_file sprockets_manifest_path, %(//= link_tree ../builds\n)
|
10
|
+
|
11
|
+
say "Stop linking stylesheets automatically"
|
12
|
+
gsub_file "app/assets/config/manifest.js", "//= link_directory ../stylesheets .css\n", ""
|
13
|
+
end
|
14
|
+
|
8
15
|
if Rails.root.join(".gitignore").exist?
|
9
16
|
append_to_file(".gitignore", %(\n/app/assets/builds/*\n!/app/assets/builds/.keep\n))
|
10
17
|
end
|
data/lib/tasks/build.rake
CHANGED
@@ -3,17 +3,21 @@ CSS_LOAD_PATH = Rails.root.join("app/assets/stylesheets")
|
|
3
3
|
CSS_BUILD_PATH = Rails.root.join("app/assets/builds")
|
4
4
|
|
5
5
|
def dartsass_build_mapping
|
6
|
-
Rails.application.config.dartsass.builds.map { |input, output|
|
6
|
+
Rails.application.config.dartsass.builds.map { |input, output|
|
7
7
|
"#{CSS_LOAD_PATH.join(input)}:#{CSS_BUILD_PATH.join(output)}"
|
8
8
|
}.join(" ")
|
9
9
|
end
|
10
10
|
|
11
|
-
def
|
12
|
-
"--
|
11
|
+
def dartsass_build_options
|
12
|
+
"--style=compressed --no-source-map"
|
13
|
+
end
|
14
|
+
|
15
|
+
def dartsass_load_paths
|
16
|
+
[ CSS_LOAD_PATH ].concat(Rails.application.config.assets.paths).map { |path| "--load-path #{path}" }.join(" ")
|
13
17
|
end
|
14
18
|
|
15
19
|
def dartsass_compile_command
|
16
|
-
"#{EXEC_PATH} #{
|
20
|
+
"#{EXEC_PATH} #{dartsass_build_options} #{dartsass_load_paths} #{dartsass_build_mapping}"
|
17
21
|
end
|
18
22
|
|
19
23
|
namespace :dartsass do
|
data/lib/tasks/clobber.rake
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dartsass-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-02-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -35,6 +35,8 @@ files:
|
|
35
35
|
- MIT-LICENSE
|
36
36
|
- README.md
|
37
37
|
- Rakefile
|
38
|
+
- exe/aarch64-linux/sass
|
39
|
+
- exe/arm64-darwin/sass
|
38
40
|
- exe/dartsass
|
39
41
|
- exe/darwin/LICENSE
|
40
42
|
- exe/darwin/sass
|