Skip to content
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

Stylesheet paths #60

Open
Sephi-Chan opened this issue Sep 23, 2017 · 1 comment
Open

Stylesheet paths #60

Sephi-Chan opened this issue Sep 23, 2017 · 1 comment

Comments

@Sephi-Chan
Copy link

Sephi-Chan commented Sep 23, 2017

Hello,

I'm using Rails 5.1.4 and I can't get the stylesheet to work due to the path produced by Princely.

As the app is not in production yet, the stylesheet doesn't exist (in public) and even with rails assets:precompile the path has a MD5 hash in it so it's doesn't work either. I can't give Princely an absolute path to a stylesheet.

Do you have a good way to work around that?

For now, i just inlined the style in a style tag of the layout.

@joshuaflanagan
Copy link

joshuaflanagan commented May 1, 2018

It would be really helpful to know why this code exists:

if Rails::VERSION::MAJOR >= 5
ActionController::Base.send(:prepend, Princely::PdfHelper)
else
ActionController::Base.send(:include, Princely::PdfHelper)
end

If we go back to just include Princely::PdfHelper (instead of prepending it), then we will get the version of #asset_file_path defined in Princely::AssetSupport at runtime. But with this prepend, we end up getting the #asset_file_path from PdfHelper, which is not aware of the asset pipeline, and causes the problem described by this issue.

It appears that the switch from include to prepend was done intentionally for Rails 5 support, but there is no explanation as to why.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants