Closed owenbendavies closed 12 years ago
I'd recommend going one abstraction level deeper in your helper and using the asset_path
helper.
Here's an (untested) example based on the stylesheet_link_tag
helper:
def css_paths_for_tinymce(source="application.css")
if debug_assets? && asset = asset_paths.asset_for(source, 'css')
asset.to_a.map { |dep|
asset_path(dep, :ext => 'css', :body => true, :protocol => :request, :digest => digest_assets?)
}.join(",")
else
asset_path(source, :ext => 'css', :body => false, :protocol => :request, :digest => digest_assets?)
end
end
Is it possible to add a method to be able to include all stylesheets from the application when compiled using the rails 3.1 asset pipeline so that the editor styling is the same as the rest of the website.
As a work around, I have implemented a dirty hack where the content_css init variable is set to the following:
stylesheet_link_tag('application').split("\n").map{|stylesheet| stylesheet.match(/href="([^"]+)"/).to_a[1]}.join(",")
If anyone has any other ideas of a better way of achieving this, that would be great.
Thanks,
Owen