Add assets helpers to rails views#38
Merged
excid3 merged 4 commits intoexcid3:mainfrom Jul 14, 2025
javierav:assets-helper
Merged
Add assets helpers to rails views#38excid3 merged 4 commits intoexcid3:mainfrom javierav:assets-helper
excid3 merged 4 commits intoexcid3:mainfrom
javierav:assets-helper
Conversation
excid3
reviewed
Jan 26, 2025
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When generating PDFs using Chrome we have to take into account certain limitations as documented in a post on Nathan Friend's blog. Perhaps the most relevant is that headers and footers can't use external resources, which forces us to add them inline if they are CSS styles or JavaScript code or to add them in base64 if they are images.
To simplify all this operations, this PR adds three helpers to help us in this task:
ferrum_pdf_inline_stylesheetferrum_pdf_inline_javascriptferrum_pdf_base64_assetFor example:
Initially it only has support for assets managed by Propshaft or Sprockets, but it can be extended to other libraries.
I am delighted to collaborate on this project and open to any ideas or suggestions for improvement.