Forum: Ruby on Rails Taking advantage of Ruby on Rails Asset Compiler

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Nick Khamis (Guest)
on 2013-08-06 10:44
(Received via mailing list)
Hello Everyone,

We would like to place our pure HTML+CSS with Javascript application
into a Ruby on Rails project within eclipse using Aptana. What we are
trying to take advantage of is Ruby on Rails Asset Pipeline.

Our project uses JQuery, Backbone and Bootstrap. So starting from the

1) I placed all 3rd part libraries in `vendor/assets/javascripts`
(backbone-min.js, jquery-1.7.1.min.js,underscroe-min.js)
2) Placed our javascript implementation in `app/javascripts/`
(application.js, main.js, utils.js)
3) Images in `app/assets/images`

Now this is where I want to make sure of a few things.

i) Where do we place the pure HTML code?
ii) As mentioned we are using backbone and not sure if:


window.Wine = Backbone.Model.extend({
urlRoot: "rs/wines",
defaults: {
"id": null,
        "name":  "",
         "grapes":  "",
 "country":  "USA",
 "region":  "California",
 "year":  "",
 "description":  "",
 "picture":  ""


window.Wine = Backbone.Model.extend({
urlRoot: "rs/wines",
defaults: {
"id": null,
    "name":  "",
    "grapes":  "",
    "country":  "USA",
    "region":  "California",
    "year":  "",
    "description":  "",
    "picture":  ""

window.WineCollection = Backbone.Collection.extend({
model: Wine,
url: "rs/wines"

Backbone Templates (HTML Fragments):

<li><a href='#wines/<%= id %>'><%= name %></a></li>

Should be placed to take full advantage of what Asset Pipeline has to
our HTML project. Things like
minify etc...

PS We do not use any ruby or rails code in our project.

Your Help is Greatly Appreciated,

F3ce6b38fab69a0a8ba9226bc0b407d5?d=identicon&s=25 Walter D. (walterdavis)
on 2013-08-06 16:09
(Received via mailing list)
On Aug 5, 2013, at 10:01 AM, Nick Khamis wrote:

> 2) Placed our javascript implementation in `app/javascripts/` (application.js,
main.js, utils.js)
>   urlRoot: "rs/wines",
> });
>       "country":  "USA",
> });
> Your Help is Greatly Appreciated,
> Nick

Wow. This seems like an awful lot of extra work to get the benefits of
the asset pipeline. Have you looked at any of the recent crop of
static-site compiler desktop apps? See
for one example (these seem to be popping up like daisies lately).

Or the huge crop of command-line tools to do the same thing? See
for one list I found immediately.

If you enable GZIP compression on your server, you could get a lot of
these benefits for nearly no effort. See, the thing about the asset
pipeline is that it is designed to give a highly dynamic Ruby-generated
site the same sort of tools that the static site crowd already enjoy. I
think you may be barking up the wrong tree here.

Nick Khamis (Guest)
on 2013-08-06 16:59
(Received via mailing list)
Hello Walter,

Thank you so much for your response. Actually, a lot of people are
migrating their front-end (HTML+CSS, JS, JQuery, Backbone...)to the
style structure and using the asset pipeline, while their back end is
implemented in Scala, Java...

After discovering backbone-rails, we even managed to maintain our
file structure for models, views, templates.  We almost have everything
structured the way we like except for a few things that we need some
clarity on:

1) Can we have a meaningful file structure for HTML pages within
have them transferred over to `public` during compile, and have the
served to us by redbrick. For deployment everything will be moved to
2) How to properly link to css and and js within our html pages to stay
up-to-date with the newly compiled md5 fingerprinting scheme of the


We tried adding the following to our html code:

<%= javascript_include_tag "application" %>
<%= stylesheet_link_tag "application" %>

Thinking it would generate

<script src="/assets/application-908e25f4bf641868d8683022a5b62f54.js"></
<link href="/assets/application-4dd5b109ee3439da54f5bdfd78a80473.css"
"screen" rel="stylesheet" />

but it did not.

Rails asset pipleine is one of the most mature out there and worth the
little bit of "extra work"....

Kind Regards,

This topic is locked and can not be replied to.