github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

radicaled / can_has_assets

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 2
    • 0
  • Source
  • Commits
  • Network (0)
  • Issues (0)
  • Downloads (1)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (1)
    • master ✓
  • Tags (1)
    • v0.4
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

can_has_assets is a super-simple way of requiring stylesheets and javascript files from within views. — Read more

  cancel

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Maintain order of included sources 
radicaled (author)
Tue Feb 10 18:46:10 -0800 2009
commit  32d623a86ae444f462015af687e0a6f531a43021
tree    59bfb68cd07a5b7199dd69527c7ad072cd81dbba
parent  4761f6fd3c8a955f774fc6f24483e831653137cc
can_has_assets /
name age
history
message
file MIT-LICENSE Loading commit data...
file README
file Rakefile
file init.rb
file install.rb
directory lib/
directory tasks/
directory test/
file uninstall.rb
README
CanHasAssets
============

can_has_assets is a super-simple way of requiring stylesheets and javascript files
from within views. It also supports inserting snippets of CSS and Javascript into
a page only once. Snippet support should really only be used for rapid prototyping,
though. :)

Installation
------------

script/plugin install git://github.com/radicaled/can_has_assets.git

Notes
-----

can_has_* will include a file or snippet only once -- it is safe to call these
methods multiple times, where-ever required.

Alternatives
------------

If you're looking for more control, consider Needy Controllers by Michael Bleigh:

http://github.com/mbleigh/needy-controllers/tree


Example
=======

In your layout:

<%= stylesheet_link_tag :can_has_assets %>
<%= javascript_include_tag :can_has_assets %>

In your views:

CSS
---
<% can_has_css 'css_file' %>

<% can_has_css :sample_snippet do %>
.item {
    /* some fake example css here */
}

Javascript
----------
<% can_has_js 'js_file' %>

<% can_has_js :sample_snippet do %>
function helloWorld() {
    alert("Hello, world!");
}
<% end %>


<% end %>
Copyright (c) 2009 Arron Washington, released under the MIT license
Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server