[LRUG] Assset pipeline

Najaf Ali ali at happybearsoftware.com
Fri Mar 7 03:39:22 PST 2014


*>  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 <http://nestacms.com>. 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20140307/fc816b40/attachment-0003.html>


More information about the Chat mailing list