[LRUG] Assset pipeline
Tommy Palmer
hi at tommyp.org
Fri Mar 7 03:44:16 PST 2014
+1 for Nesta, my personal site runs on it.
But if you really want to stick with Rails, every 3.1+ App I’ve built with images embedded inside content called from the DB had the images sitting on a content host uploaded with Carrierwave or something similar. You just have the images with the absolute url and run them through the Markdown filter as normal.
Images inside the app/assets/images folder should only be those either called in SCSS, for which you use the image-url helper (IIRC) or else the image_tag if you’re calling them in a view.
Tommy
--
Tommy Palmer
@tommypalm
http://tommyp.org/
On 7 March 2014 at 11:39:26, Najaf Ali (ali at happybearsoftware.com) wrote:
> either ignore the asset pipeline altogether for these images (by keeping them in public/images/articles/)
AFAIK you don't lose any big benefit from working like this. The big wins from the asset pipeline come from automatic css/js concatenation I think.
> or find a way to evaluate Rails's asset_path() helper within my markdown text.
Possible, but a bit hairy. In this case I think you'd probably end up evaluating ERB within your markdown. That will mean you're embedding ERB, within markdown, within HAML, which has got to offend some deity somewhere.
> What's the preferred approach here?
Not sure if it's preferred and it won't help you in this case, but after making a version of a "markdown website with Rails" more times than I could count with duplicate code all over the place, I've decided I'm just going to use nesta CMS. It appears the venn diagram of mine and Graham's (the author) taste in templating language, project structure, etc. has a large enough intersection that I'm happy with the defaults 99% of the time.
-Ali
On Fri, Mar 7, 2014 at 10:50 AM, Andrew Stewart <boss at airbladesoftware.com> wrote:
Hello LRUG!
I'm upgrading a Rails app from 3.0 to 3.1. I have an article model which stores the article's text as markdown. I use HAML's markdown filter to render it like this:
# app/views/articles/show.html.haml
%h1= @article.title
:markdown
#{@article.contents}
Some of these articles contain images. Previously all the image references looked like:
![Some text here](/images/articles/some-photo.png)
Given the asset pipeline, what paths should I use now?
I see two options:
- either ignore the asset pipeline altogether for these images (by keeping them in public/images/articles/);
- or find a way to evaluate Rails's asset_path() helper within my markdown text.
What's the preferred approach here?
Thanks in advance,
Andy Stewart
_______________________________________________
Chat mailing list
Chat at lists.lrug.org
http://lists.lrug.org/listinfo.cgi/chat-lrug.org
_______________________________________________
Chat mailing list
Chat at lists.lrug.org
http://lists.lrug.org/listinfo.cgi/chat-lrug.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20140307/822cea6c/attachment-0003.html>
More information about the Chat
mailing list