README.md in sinatra-assetpack-0.2.3 vs README.md in sinatra-assetpack-0.2.4
- old
+ new
@@ -1,11 +1,11 @@
# [Sinatra AssetPack](http://ricostacruz.com/sinatra-assetpack)
-> The most convenient way to manage your assets in Sinatra.
+> The most convenient way to manage your assets in Sinatra.
[![Build Status](https://travis-ci.org/rstacruz/sinatra-assetpack.png?branch=master)](https://travis-ci.org/rstacruz/sinatra-assetpack)
-[![Gem Version](https://badge.fury.io/rb/sinatra-assetpack.png)](http://badge.fury.io/rb/sinatra-assetpack)
+[![Gem Version](https://badge.fury.io/rb/sinatra-assetpack.png)](http://rubygems.org/gems/sinatra-assetpack)
[![Dependency Status](https://gemnasium.com/rstacruz/sinatra-assetpack.png)](https://gemnasium.com/rstacruz/sinatra-assetpack)
[![Code Climate](https://codeclimate.com/github/rstacruz/sinatra-assetpack.png)](https://codeclimate.com/github/rstacruz/sinatra-assetpack)
## Installation
@@ -65,11 +65,11 @@
<%= js :app %>
```
```
# layout.haml
!= css :application, :media => 'screen'
-!= css :app
+!= js :app
```
## Results
#### Development mode
@@ -90,40 +90,40 @@
<script type='text/javascript' src='/js/app.589491.js'></script>
```
## Features
- * __CoffeeScript support__ Just add your coffee files in one of the paths
- served (in the example, `app/js/hello.coffee`) and they will be available as JS
+ * __CoffeeScript support__ Just add your coffee files in one of the paths
+ served (in the example, `app/js/hello.coffee`) and they will be available as JS
files (`http://localhost:4567/js/hello.js`).
- * __Sass/Less/SCSS support__ Works the same way. Place your dynamic CSS files
- in there (say, `app/css/screen.sass`) and they will be available as CSS files
+ * __Sass/Less/SCSS support__ Works the same way. Place your dynamic CSS files
+ in there (say, `app/css/screen.sass`) and they will be available as CSS files
(`http://localhost:4567/css/screen.css`).
- * __Cache busting__ the `css` and `js` helpers automatically ensures the URL
- is based on when the file was last modified. The URL `/js/jquery.js` may be
- translated to `/js/jquery.8237898.js` to ensure visitors always get the latest
+ * __Cache busting__ the `css` and `js` helpers automatically ensures the URL
+ is based on when the file was last modified. The URL `/js/jquery.js` may be
+ translated to `/js/jquery.8237898.js` to ensure visitors always get the latest
version.
- * __Images support__ Image filenames in your CSS will automatically get a
+ * __Images support__ Image filenames in your CSS will automatically get a
cache-busting suffix (eg, `/images/icon.742958.png`).
- * __Embedded images support__ You can embed images in your CSS files as
+ * __Embedded images support__ You can embed images in your CSS files as
`data:` URIs by simply adding `?embed` to the end of your URL.
* __No intermediate files needed__ You don't need to generate compiled files.
You can, but it's optional. Keeps your source repo clean!
- * __Auto minification (with caching)__ JS and CSS files will be compressed as
+ * __Auto minification (with caching)__ JS and CSS files will be compressed as
needed.
* __Heroku support__ Oh yes. That's right.
## Compressors
-By default, AssetPack uses [JSMin](http://rubygems.org/gems/jsmin) for JS
+By default, AssetPack uses [JSMin](http://rubygems.org/gems/jsmin) for JS
compression, and simple regexes for CSS compression. You can specify other
compressors in the `assets` block:
``` ruby
assets {
@@ -169,12 +169,12 @@
gem 'sass'
```
### Sqwish CSS compression
-[Sqwish](http://github.com/ded/sqwish) is a NodeJS-based CSS compressor. To use
-Sqwish with AssetPack, install it using `npm install -g sqwish`. You need NodeJS
+[Sqwish](http://github.com/ded/sqwish) is a NodeJS-based CSS compressor. To use
+Sqwish with AssetPack, install it using `npm install -g sqwish`. You need NodeJS
and NPM installed.
``` ruby
assets {
css_compression :sqwish
@@ -182,11 +182,11 @@
}
```
### Google Closure compression
-This uses the [Google closure compiler
+This uses the [Google closure compiler
service](http://closure-compiler.appspot.com/home)
to compress your JavaScript. Available levels are:
* `WHITESPACE_ONLY`
* `SIMPLE_OPTIMIZATIONS`
@@ -199,15 +199,15 @@
}
```
### UglifyJS compression
-This uses the [UglifyJS](https://github.com/mishoo/UglifyJS) compressor to
-compress your JavaScript. You will need to install the
+This uses the [UglifyJS](https://github.com/mishoo/UglifyJS) compressor to
+compress your JavaScript. You will need to install the
[uglifier](http://rubygems.org/gems/uglifier) gem.
-For options, refer to the [Uglifier
+For options, refer to the [Uglifier
documentation](https://github.com/lautis/uglifier).
``` ruby
assets {
js_compression :uglify
@@ -240,16 +240,16 @@
/* Original: */ .email { background: url(/images/email.png); }
/* Output: */ .email { background: url(/images/email.6783478.png); }
```
#### Image embedding
-Want to embed images as `data:` URI's? Sure! Just add `?embed` at the end of the
+Want to embed images as `data:` URI's? Sure! Just add `?embed` at the end of the
URL.
``` css
/* Original: */ .email { background: url(/images/email.png?embed); }
-/* Output: */ .email { background: url(data:image/png;base64,NF8dG3I...); }
+/* Output: */ .email { background: url(data:image/png;base64,NF8dG3I...); }
```
## Precompile
``` ruby
@@ -289,21 +289,21 @@
end
end
```
#### Getting options
-Invoking it without a block allows you to access the options. This works for
+Invoking it without a block allows you to access the options. This works for
almost all the options, with the exception for `css`, `js` and `serve`.
``` ruby
App.assets
App.assets.js_compression #=> :yui
```
### assets.serve
-Serves files from `LOCALPATH` in the URI path `PATH`. Both parameters are
+Serves files from `LOCALPATH` in the URI path `PATH`. Both parameters are
required.
``` ruby
# Usage
serve 'PATH', :from => 'LOCALPATH'
@@ -317,11 +317,11 @@
serve '/js', from: '/app/javascripts'
```
### assets.js\_compression<br>assets.css\_compression
-Sets the compression engine to use for JavaScript or CSS. This defaults to
+Sets the compression engine to use for JavaScript or CSS. This defaults to
`:jsmin` and `:simple`, respectively.
If `OPTIONS_HASH` is given as a hash, it sets options for the engine to use.
``` ruby
@@ -333,11 +333,11 @@
css_compression :ENGINE, OPTIONS_HASH
}
```
#### Examples
-Yo seriously check this out: the first line uses Sqwish with it's defaults, and
+Yo seriously check this out: the first line uses Sqwish with it's defaults, and
the second line uses Sqwish with it's magic.
``` ruby
assets {
css_compression :sqwish
@@ -345,11 +345,11 @@
}
```
### assets.js\_compression\_options<br>assets.css\_compression\_options
-Sets the options for the compression engine to use. This is usually not needed
+Sets the options for the compression engine to use. This is usually not needed
as you can already set options using `js_compression` and `css_compression`.
``` ruby
# Usage:
assets {
@@ -367,19 +367,19 @@
### assets.css<br>assets.js
Adds packages to be used.
-The `NAME` is a symbol defines the ID for that given package that you can use
-for the helpers. That is, If a CSS package was defined as `css :main, [ ... ]`,
+The `NAME` is a symbol defines the ID for that given package that you can use
+for the helpers. That is, If a CSS package was defined as `css :main, [ ... ]`,
then you will need to use `<%= css :main %>` to render it in views.
the `URI` is a string that defines where the compressed version will be served.
It is optional. If not provided, it will default to `"/assets/name.type"` (eg:
`/assets/main.css`).
-the `PATHs` is an array that defines files that will be served. Take note that
+the `PATHs` is an array that defines files that will be served. Take note that
this is an array of URI paths, not local paths.
If a `PATH` contains wildcards, it will be expanded in alphabetical order.
Redundancies will be taken care of.
@@ -392,12 +392,12 @@
js:NAME, 'URI', [ PATH1, PATH2, ... ]
}
```
#### Example
-In this example, JavaScript files will be served compressed as
-`/js/application.js` (default since no `URI` is given). The files will be taken
+In this example, JavaScript files will be served compressed as
+`/js/application.js` (default since no `URI` is given). The files will be taken
from `./app/javascripts/vendor/jquery*.js`.
``` ruby
class App < Sinatra::Base
assets {
@@ -415,16 +415,16 @@
### assets.ignore
Excludes any URL paths that match the given spec.
These files will not show up in packages, and they will not be accessible.
-By default, `.*` and `_*` are ignored. The former protects folders such as
-`.svn` from being accessed, and the latter protects Sass partial files from
+By default, `.*` and `_*` are ignored. The former protects folders such as
+`.svn` from being accessed, and the latter protects Sass partial files from
being accessed directly.
-Note that this matches against URL paths, not local file paths. This means
-something like `*.scss` will not work, as all stylesheet files will be compiled
+Note that this matches against URL paths, not local file paths. This means
+something like `*.scss` will not work, as all stylesheet files will be compiled
to `.css`.
``` ruby
# Usage:
assets {
@@ -446,11 +446,11 @@
}
end
```
#### Advanced usage
-By default, `.*` and `_*` are ignored. To disable this behavior, you can use
+By default, `.*` and `_*` are ignored. To disable this behavior, you can use
`clear_ignores!` before your `ignore` lines.
``` ruby
assets {
clear_ignores!
@@ -466,21 +466,21 @@
### assets.prebuild
Caches the built packages on application startup.
-If this is not used, the packages will be minified when they are first
+If this is not used, the packages will be minified when they are first
requested. This only has an effect in the production environment (or when
Sinatra's `reload_templates` is otherwise set to false).
``` ruby
# Usage:
prebuild {true|false}
```
#### Example
-In this example, the package for `:application` will be built when the
+In this example, the package for `:application` will be built when the
application is started in the production environment.
``` ruby
class App < Sinatra::Base
assets {
@@ -528,11 +528,11 @@
```
### assets.cache_dynamic_assets
Caches dynamic files unless they have been modified.
-Useful during development if asset compilation of all dynamic assets on each request is slow.
+Useful during development if asset compilation of all dynamic assets on each request is slow.
If set to true, dynamic assets will be compiled on the initial asset request, but only be re-compiled when the asset's mtime changes.
``` ruby
# Usage:
cache_dynamic_assets {true|false}
@@ -551,18 +551,19 @@
'/js/vendor/jquery.js'
]
cache_dynamic_assets true
}
end
+```
## Helpers
These are helpers you can use in your views.
### <%= css %>
-Shows a CSS package named `PACKAGE`. If `OPTIONS_HASH` is given, they will we
+Shows a CSS package named `PACKAGE`. If `OPTIONS_HASH` is given, they will we
passed onto the `<link>` tag to be generated as attributes.
You may specify as many packages as you need, as shown in the second usage line.
``` ruby
@@ -615,21 +616,21 @@
<script type='text/javascript' src='/js/main.783439.js' id='main_script'></script>
```
### <%= img %>
-Shows an `<img>` tag from the given `SRC`. If the images is found in the asset
-directories (and ImageMagick is available), `width` and `height` attributes will
+Shows an `<img>` tag from the given `SRC`. If the images is found in the asset
+directories (and ImageMagick is available), `width` and `height` attributes will
be added.
``` ruby
# Usage:
img 'SRC'
img 'SRC', OPTIONS_HASH
```
-If `OPTIONS_HASH` is given, they will we passed onto the `<img>` tag to be
+If `OPTIONS_HASH` is given, they will we passed onto the `<img>` tag to be
generated as attributes.
#### Example
This example renders an image with an alt tag.
@@ -670,6 +671,6 @@
[rsc]: http://ricostacruz.com
[c]: http://github.com/rstacruz/sinatra-assetpack/contributors
[sf]: http://sinefunc.com
[j15e]: http://github.com/j15e
-[hookt]: http://github.com/hooktstudios
\ No newline at end of file
+[hookt]: http://github.com/hooktstudios