Sha256: ffc100083984f38be9be9e8ad76be895ba04a496a5f1c7ac709d70f72e9b6f21

Contents?: true

Size: 1.51 KB

Versions: 2

Compression:

Stored size: 1.51 KB

Contents

This gem was born out of frustration when I was dealing with assets in non-rails environment. I wanted an experience similar to asset_packager: you just specify all your assets and then in development you have them as they are, but in production all compressed in one file.

As a result I produced a small library in just around 100 lines to manage assets in any rack-based framework. For compression this gem uses yuicompressor (so you'll need java installed, as opposed to jsmin.rb but it doesn't require you to put semicolons after each statement).

Workflow is simple. You define a specification of your assets in *config/assets.yml*:
<code>
    ---
    js:
      - http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js
      - jquery.tools
      - jquery.autocomplete
      - jquery.address
      - application
    css:
      - application
</code>

You can specify web and local assets. Local assets will be looked up in public/javascripts and public/stylesheets folders.

And then you use <code>Assets.js.bundle</code> and <code>Assets.css.bundle</code> to include assets in your view.

This gem doesn't produce compressed files on demand in production, cause such request would get slow. So instead you need to compress files when you deploy your application, just use <code>Assets.js.compress</code> and <code>Assets.css.compress</code> for this purpose.

You can easily change location of config file, javascripts and stylesheets folders, just look into code and you'll see how.

If you need help don't hesitate to ask me ;-)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
brainopia-assets-0.9.10 README.md
brainopia-assets-0.9.9 README.md