-
Notifications
You must be signed in to change notification settings - Fork 45
Add an ability to build assets from Rails root folder #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
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") | ||
CSS_LOAD_FROM_RAILS_ROOT_PATH = Rails.root | ||
|
||
def dartsass_build_mapping | ||
Rails.application.config.dartsass.builds.map { |input, output| | ||
"#{CSS_LOAD_PATH.join(input)}:#{CSS_BUILD_PATH.join(output)}" | ||
}.join(" ") | ||
builds_map = Rails.application.config.dartsass.builds.map { |input, output| | ||
input_file_path = "#{CSS_LOAD_PATH.join(input)}" | ||
input_file_path = "#{CSS_LOAD_FROM_RAILS_ROOT_PATH.join(input)}" unless File.exist?(input_file_path) | ||
"#{input_file_path}:#{CSS_BUILD_PATH.join(output)}" | ||
} | ||
builds_map.uniq.join(" ") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks like easy workaround for now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. awesome PR #11 was merged recently. so we have but it doesn't solve our use-case when we need to pre-compile (and watch) files located in non-standard assets folders outside of |
||
end | ||
|
||
def dartsass_build_options | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
app/
folder from this exampleapp/index.sass
as it gives us wrong impression that we are starting from Rail's root folder (but we are technically enforcing prefixapp/assets/stylesheets/
to each source file)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah! that's correct. When I was integrating even I thought the same and gave path accordingly. But later realised that it is from
app/assets/stylesheets