K
K
Kasheftin2011-09-23 11:59:16
Ruby on Rails
Kasheftin, 2011-09-23 11:59:16

What is the feature of the asset pipeline?

I read this , this and this , got inspired, began to upgrade one unfinished rails project, nothing worked, now I have a number of both technical and general questions, such as whether the asset pipline is as cool and useful as it is painted.
The main technical question is how to make the asset pipeline work with compass? I had compass+blueprint in rails 3.0.9, generated screen.css, print.css. I transfer scss to assets - naturally, compass imports and includes do not work. There are issues and alpha versions of the compass about this, but even if everything turns on, then why the asset pipeline? @include from the compass is cooler, since they can (and should) be added to separate classes, but is it the same with the built-in *= require from the asset pipeline?
With javascript, the situation is completely incomprehensible. Why merge the jquery core and jquery-ui with self-written scripts into one file? On the contrary, it was considered useful to minimize traffic by downloading common files like jquery.js from code.google.com. And now everything is in one file. A little hack in any controller entails reloading all the standard libraries, including jquery(-ui).
There is one problem that I would like to solve. I connect page-specific javascripts from views via

<% content_for :js do %>
<%= javascript_include_tag "script1" %>
<%= javascript_include_tag "script2" %>
<% end %>
But this block can be called only once, repeated calls in different partials rewrite it. And I would like the code to add up, and even without repetitions. How to do this, maybe using the asset pipeline?
In general, what other advantages of the asset pipeline do you know? Minimizes automatically through uglifier, it's cool. You can also put ruby ​​variables directly into js, ​​this is not very cool, because it is still more correct to separate the code from the data. What else?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sl_bug, 2011-09-23
@sl_bug


@include from
the compass works fine using the master branch (you may have to fix something in the configs, but it's already in place to look) But if you really want to, then generate some other manifest (like application.js) and use different files on different pages.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question