public
Rubygem
Description: Rails Plugin - a Ruby way to manage your stylesheets and javascripts. Don't put all your assets in your layout; define what you need where you need them.
Homepage: http://6brand.com
Clone URL: git://github.com/JackDanger/sweet_assets.git
JackDanger (author)
Thu Sep 25 17:42:28 -0700 2008
commit  75b20248cebfaec1f0a07ce348005d0f94cf3027
tree    4bd6910f0497a31d07eb72695f77bb21dbdffd09
parent  6c6f39e01f54ec35f400eaccf04afc1e44074d3c
sweet_assets / README.txt
100644 50 lines (32 sloc) 1.842 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
= SweetAssets
 
http://github.com/JackDanger/sweet_assets
 
== Description
 
  Automate adding stylesheets and javascripts to your controller actions
 
== Example
 
  Any controller will include the stylesheet and javascript source files named after named after the contorller if the file exists:
  
    class UsersController < ApplicationController
      ...
    end
    
    http://mysite.com/users/ will have /stylesheets/users.css and /javascripts/users.js included if they exist.
    
  Any controller can specify any other file to be added as a stylesheet:
  
    class UsersController < ApplicationController
      style_like :homes
      script_like :gargantuan
    end
    
    http://mysite.com/users/ will have users.css, homes.css and gargantuan.js included
    
  Any asset that needs to take precedence over others (i.e. should be linked after the other stylesheets) can be used with a bang (!)
  
    class UsersController < ApplicationController
      style_like :distort_reality!, :homes, :trees
      script_like :basic_script, :super_enhancement!
    end
    
    http://mysite.com/users/ will have homes.css, and trees.css and basic_script.js linked before the <title> tag.
    distort_reality.css and super_enhancement.js will be linked after the <title> tag.
    Note: the controller-named assets (users.css and users.js in this case) will always
    be applied with precedence.
 
  If you need better control over where these assets appear you can use the same options as you would for a before_filter
    
    class UsersController < ApplicationController
      style_like :homes!, :only => :show
      script_like :trees, :except => [:index, :show]
    end
 
  All linked assets will be cached into a single asset if caching is enabled.
 
Copyright (c) 2007 Jack Danger Canty of adPickles Inc, released under the MIT license