0.0
No commit activity in last 3 years
No release in over 3 years
Adds a couple of class and instance methods to controllers and views that help you load assets
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.1.3
~> 1.8.3
= 3.0.12
~> 3.12
>= 2.0.0.beta
 Project Readme

specific_assets

Rails extension to easily add custom css and js in controllers and views

Why do you need this?

Ever needed to add different css and js to different pages of the website, but felt that creating a new layout would be an overkill?

Now you can just say:

add_css "registration", "some_other_fancy_stuff"
add_js "registration"

and you'll get respective css and js files included into the page.

INSTALLATION

gem install specific_assets

Usage

First, you should add this to your layout:

js_assets.each { |js| javascript_include_tag(js) }
css_assets.each { |css| stylesheet_link_tag(css) }

Now you're ready to use #add_js and #add_css methods. Those methods are available as helpers in views, and both as instance and class methods in controllers. If class methods are used, then assets will be added for all the actions in the controller.

Usage examples:

class UsersController < ApplicationController

  add_css "users"
  add_js "users"

  def new
    add_css "new_user"
  end

  def show
    add_js "user_profile", "user_animations"
  end

end