dartsass-rails 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 66fafe0b069b2b52d2bea2dacd17eba808087e97edd7f64453ba40461afa5a69
4
- data.tar.gz: c387c8b7adb29211b6993485ae19b3f58d8cdfb6a75eed8bd1139d1d51a486f6
3
+ metadata.gz: 2bb5dbbe961c634d409fb2970b7f38bdc3ada499464fbd3f6b08e7611912601a
4
+ data.tar.gz: 37d5f1fedc4776681e06f644d78e1ec0535d4d64f7cd69bc94ad268fcdb35d88
5
5
  SHA512:
6
- metadata.gz: 58dc3c83d2b3754aad2d774ddb3f10f6b78d9e907097b61ed466d3b2734e6b4d492b192e7dee83443b705459a3560a38c8b44c652e1e0f4592ae7873cdac8f1a
7
- data.tar.gz: 7fed1df3503131583f165553a9b9dd2de454b8c4fb324f19854a89e85e9b1e1ff7fc665e31095b5caf51effe782ea4fd6d872740ccd25aabac0ea1b33f7faf4b
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 has 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/`.
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
- os = Gem::Platform.local.os
6
+ platform_info = Gem::Platform.local
7
+ platform_string = "#{platform_info.cpu}-#{platform_info.os}"
7
8
 
8
9
  exe_path =
9
- case os
10
- when "darwin" then File.join(__dir__, "darwin/sass")
11
- when "linux" then File.join(__dir__, "linux/sass")
12
- when "mingw32" then File.join(__dir__, "mingw32/sass.bat")
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 #{os} operating system
18
+ ERROR: dartsass-rails does not support the #{platform_string} platform
16
19
  ERRMSG
17
20
  exit 1
18
21
  end
@@ -1,3 +1,3 @@
1
1
  module Dartsass
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -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 dartsass_load_path
12
- "--load-path #{CSS_LOAD_PATH}"
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} #{dartsass_load_path} #{dartsass_build_mapping}"
20
+ "#{EXEC_PATH} #{dartsass_build_options} #{dartsass_load_paths} #{dartsass_build_mapping}"
17
21
  end
18
22
 
19
23
  namespace :dartsass do
@@ -2,6 +2,7 @@ namespace :dartsass do
2
2
  desc "Remove CSS builds"
3
3
  task :clobber do
4
4
  rm_rf Dir["app/assets/builds/[^.]*.css"], verbose: false
5
+ rm_rf Dir["app/assets/builds/[^.]*.css\.map"], verbose: false
5
6
  end
6
7
  end
7
8
 
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.2.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-01-22 00:00:00.000000000 Z
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