maybe Im asking too much, but I want you, Rails developers to share your assets
pipeline configurations.
Im really loving Rails but some things doesn''t fit in my head and I
need solutions (this perfectionism will kill me someday :P)
Is not THAT bad having all CSS and all JS compressed into one file (I think that
having an import on every erb is not that bad). The problem is when you have
third party css like ActiveAdmin''s one that conflict with your own CSS.
I think that the default options are not the best, just a starting.
I will share what actually work for me and I hope to see if my solutions sucks
and what are your solutions.
One idea is:
Remove require_tree from "application.js" and
"application.css".
In application.html.erb change:
<%= stylesheet_link_tag "application", controller_name, :media
=> "all" %>
<%= javascript_include_tag "application", controller_name %>
So in a controller I''ll have my app js/css and my controller js/css.
If a controller need more deps, I can add them on the views or in the js/css
(like in app js/css).
Next, I add every controller js / css into production.rb like:
config.assets.precompile += %w( people.css languages.css people.js
languages.js )
So I get a compiled css for every controller and a compiled js for every
controller. The only downside is to add all extra stuff on
"production.rb"
What you think? Maybe have flaws, dont know.
Solution 2:
On ActiveAdmin screencast, I saw that a solution is to remove
"require_tree" and then convert the application.css to sass and then:
@import "controller_css";
For every css. And same for js.
Is the same stuff as solution 1 but having ALL css/js in the same file.
So, can you share your ideas and criticize my solutions?
Thanks.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/rubyonrails-talk/-/E4NNqGH5YuwJ.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.