-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d227ae6
commit ba38934
Showing
2 changed files
with
30 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
module Dartsass | ||
module Runner | ||
EXEC_PATH = "#{Pathname.new(__dir__).to_s}/../../exe/dartsass" | ||
CSS_LOAD_PATH = Rails.root.join("app/assets/stylesheets") | ||
CSS_BUILD_PATH = Rails.root.join("app/assets/builds") | ||
|
||
module_function | ||
|
||
def dartsass_build_mapping | ||
Rails.application.config.dartsass.builds.map { |input, output| | ||
"#{CSS_LOAD_PATH.join(input)}:#{CSS_BUILD_PATH.join(output)}" | ||
} | ||
end | ||
|
||
def dartsass_build_options | ||
Rails.application.config.dartsass.build_options.flat_map(&:split) | ||
end | ||
|
||
def dartsass_load_paths | ||
[ CSS_LOAD_PATH ].concat(Rails.application.config.assets.paths).flat_map { |path| ["--load-path", path.to_s] } | ||
end | ||
|
||
def dartsass_compile_command | ||
[ RbConfig.ruby, EXEC_PATH ].concat(dartsass_build_options).concat(dartsass_load_paths).concat(dartsass_build_mapping) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters