Project

assets_js

0.01
No commit activity in last 3 years
No release in over 3 years
Provides rails asset helpers to your client side javascript
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 3.0
~> 2.4
 Project Readme

assets_js¶ ↑

Description¶ ↑

Provides some javascript helpers for Rails assets.

Features¶ ↑

Examples¶ ↑

Add this to your application.js

//= require 'assets_js'

Then somewhere else in your application.js you will be able to reference assets with:

asset_path('rails.png')
=> '/assets/rails.png'

This works if you have digests enabled too:

asset_path('rails.png');
=>  '/assets/rails-dc0842763ddf5d7ea5c32b7e8a4cfa39.png'

asset_url('rails.png');
=> 'http://www.example.com/assets/rails-dc0842763ddf5d7ea5c32b7e8a4cfa39.png'

There are some simple tag helpers too:

image_tag('rails.png');
=> <img src="/assets/rails-dc0842763ddf5d7ea5c32b7e8a4cfa39.png" />

javascript_include_tag('app.js');
=> <script type="text/javascript" src="/assets/app-dc0842763ddf5d7ea5c32b7e8a4cfa39.js"></script>

stylesheet_link_tag('style.css');
=> <link rel="stylesheet" media="screen" href="/assets/style-dc0842763ddf5d7ea5c32b7e8a4cfa39.css" />

Requirements¶ ↑

Install¶ ↑

$ gem install assets_js

Copyright © 2012 John Butler

See LICENSE.txt for details.