NO LONGER IN DEVELOPMENT, obvs.
jQuery-UI themes CDN script tags and fallback in one neat package.
I get tired of copy and pasting and downloading and moving… jQuery files and script tags etc. This does it for me (along with https://github.com/yb66/rack-jquery), and keeps version management nice 'n' easy.
They're not dependencies, but if you're going to use this then I bet you'll be interested in using them.
Rack::JQueryUI::Theme doesn't sound right to me, as it's accessing the Themes service/files. I doubt you'll ever instantiate a instance of the class yourself, and the computer doesn't mind, so let it go.
Have a look in the examples directory, but here's a snippet.
-
Install it (see below)
-
require 'rack/jquery_ui/themes'
. -
Put this in your middleware stack:
use Rack::JQueryUI::Themes, :theme => "vader"
-
Put this in the head of your layout (the example is Haml but you can use whatever you like)
%head = Rack::JQueryUI::Themes.cdn env, :organisation => :microsoft
Now you have the script tags to Microsoft's CDN in the head (you can also use Media Temple or Microsoft, see the docs).
It also adds in a bit of javascript that will load in a locally kept version of jQuery, just incase the CDN is unreachable. The script will use the "/js/jquery-ui/1.10.3/themes/:THEME/jquery-ui.min.css" path (or, instead of 1.10.3, whatever is in {Rack::JQueryUI::JQUERY_UI_VERSION}), where :THEME
is the name of the theme you specified, the default being smoothness
.
That was easy.
You have to have loaded jQuery before using the CDN helper, as Rack::jQueryUI::Themes relies on it. I've already mentioned Rack::JQuery which you can use to do this, or load the script however you like. Just remember that it needs to be there.
This library uses semver to version the library. That means the library version is not an indicator of quality but a way to manage changes. The version of jQuery-UI can be found in the lib/rack/jquery_ui/themes/version.rb file, or via the {Rack::JQueryUI::JQUERY_UI_VERSION} constant.
Add this line to your application's Gemfile:
gem 'rack-jquery_ui-themes'
And then execute:
$ bundle
Or install it yourself as:
$ gem install rack-jquery_ui-themes
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
See the LICENCE.txt file.