README.md in jekyll-assets-0.10.1 vs README.md in jekyll-assets-0.11.0

- old
+ new

@@ -22,16 +22,18 @@ configuration option for other variants. - Produce gzipped versions of assets. See `gzip` configuration option for details. - [Compass][compass], [Bourbon][bourbon] and [Neat][neat] built-in support. See "Custom Vendors" below. +- [Rails Assets][rails_assets] support - [Autoprefixer][autoprefixer] support [compass]: http://compass-style.org/ [bourbon]: http://bourbon.io/ [neat]: http://neat.bourbon.io/ [autoprefixer]: https://github.com/postcss/autoprefixer +[rails_assets]: https://rails-assets.org/ Jekyll-Assets uses fabulous [Sprockets][sprockets] under the hood, so you may refer to Rails guide about [Asset Pipeline][rails-guide] for detailed information about amazing features it gives you. @@ -81,10 +83,30 @@ - `{% stylesheet app %}`: Generates `<link>` tag for `app.css` - `{% image logo.png %}`: Generates `<img>` tag for `logo.png` - `{% asset_path logo.png %}`: Returns _resulting_ URL for `logo.png` - `{% asset app.css %}`: Returns _compiled_ body of `app.css` +You can pass extra attributes to `javascript`, `stylesheet` and `image` tags: + +``` html +{% image logo.png alt="Logo" %} +{% javascript app async %} +{% stylesheet app actually="anything" you might='want' %} + +<!-- renders to something like this (linebreaks in tags for readability here) --> + +<img src="/assets/logo-68b329da9893e34099c7d8ad5cb9c940.png" alt="Logo"> +<script src="/assets/app-6b95b1b3231c52113ca34ae9d1b5dabf.js" async></script> +<link rel="stylesheet" href="/assets/app-349212fba570137adfec745e37b6d7fb.css" + actually="anything" you might='want'> + +<!-- NOTICE !!! if your asset file contains spaces, surround it's name with quotes --> + +{% asset_path "my logo.png" %} +{% asset_path 'my logo.png' %} +``` + Also you'll have complimentary Liquid filters as well: - `{{ 'app' | javascript }}`: Generates `<script>` tag for `app.js` - `{{ 'app' | stylesheet }}`: Generates `<link>` tag for `app.css` - `{{ 'logo.png' | image }}`: Generates `<img>` tag for `logo.png` @@ -307,10 +329,14 @@ Require `jekyll-assets/bootstrap` to enable, e.g.: ``` ruby require "jekyll-assets" + +# bootstrap requires minimum precision of 10, see https://github.com/twbs/bootstrap-sass/issues/409 +::Sass::Script::Number.precision = [10, ::Sass::Script::Number.precision].max + require "jekyll-assets/bootstrap" ``` Now you can add `@import "bootstrap"` in your SASS assets to get Bootstrap goodies. @@ -348,9 +374,36 @@ require "jekyll-assets/neat" ``` Now you can add `@import "neat"` in your SASS assets to get Neat goodies. + +### Rails Assets Support + +[Rails Assets][rails_assets] allows you to easily install Bower dependencies via Bundler. + +Install your Bower dependencies in the `rails_assets` group in your `Gemfile`: + +``` ruby +group :rails_assets do + gem "rails-assets-jquery" + gem "rails-assets-angular" +end +``` + +Require `jekyll-assets/rails-assets` to enable, e.g.: + +``` ruby +require "jekyll-assets" +require "jekyll-assets/rails-assets" +``` + +Now you can `require` these dependencies in your assets, e.g. `site.js`: + +``` javascript +//= require jquery +//= require angular +``` ## Autoprefixer To enable Autoprefixer, add `autoprefixer-rails` to your `Gemfile`: