classy_assets 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +50 -6
- data/lib/classy_assets/version.rb +1 -1
- data/spec/rack/classy_assets_spec.rb +1 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ccdf4e3653be4abe6a48d37433a1ceb0257fc836
|
4
|
+
data.tar.gz: a15342332f9786b22fe93f1f74abdc94660bd58d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 227652b02943447bc6a8aab0c7a2d3172b82a70719d69b9ca750ea15a1e3cf107e13b7198a1773dd6e6abac88107c5a8339c6c85fbcd81f7b2f0c79fbddf96bf
|
7
|
+
data.tar.gz: 8a87a9f9a425851f882d57e16ceb2cca6656d8cbc018cf63568cbe7db11bb38a8be27769d982e192285e2f859ad7522c3927fc12bb05fe95b4337f72da5dffe3
|
data/README.md
CHANGED
@@ -1,24 +1,68 @@
|
|
1
1
|
# ClassyAssets
|
2
2
|
|
3
|
-
|
3
|
+
Classy Assets (powered by Sprockets) for Sinatra and Rack apps
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
7
7
|
Add this line to your application's Gemfile:
|
8
8
|
|
9
|
-
gem 'classy_assets'
|
9
|
+
gem 'classy_assets', require: 'false'
|
10
10
|
|
11
11
|
And then execute:
|
12
12
|
|
13
13
|
$ bundle
|
14
14
|
|
15
|
-
|
15
|
+
## Usage
|
16
16
|
|
17
|
-
|
17
|
+
ClassyAssets is available as Rack Middleware or a Sintra Extension. The Sinatra Extension version integrates the [sprockets-helpers](https://github.com/petebrowne/sprockets-helpers) to provide helper methods for generating asset paths.
|
18
18
|
|
19
|
-
|
19
|
+
Use the Rack Middleware directly:
|
20
|
+
|
21
|
+
````ruby
|
22
|
+
require 'rack/classy_assets'
|
23
|
+
class ClassyApp < Sinatra::Base
|
24
|
+
use Rack::ClassyAssets, root: 'path/to/your/app/root/directory'
|
25
|
+
end
|
26
|
+
````
|
27
|
+
|
28
|
+
Use the Sinatra Extension:
|
29
|
+
|
30
|
+
````ruby
|
31
|
+
require 'sinatra/classy_assets'
|
32
|
+
class ClassyApp < Sinatra::Base
|
33
|
+
register Sinatra::ClassyAssets
|
34
|
+
end
|
35
|
+
````
|
36
|
+
|
37
|
+
Both the middleware and extension assume your assets are stored in the `root` directory, in the following layout:
|
38
|
+
|
39
|
+
/assets
|
40
|
+
|_ images
|
41
|
+
|_ stylesheets
|
42
|
+
|_ javascripts
|
43
|
+
|
44
|
+
Sass and CoffeeScript are fully supported.
|
45
|
+
|
46
|
+
Available Options:
|
47
|
+
|
48
|
+
Pass these in via the options hash if you're using the rack middleware.
|
49
|
+
If you're using the sinatra extension, then configure your app's `settings` after the `register Sintra::ClassyAssets` statement to override the defaults
|
50
|
+
|
51
|
+
````ruby
|
52
|
+
:root # => path to root of the application. set by default in Sinatra apps, but must be explictly passed to the rack middleware, if used directly
|
53
|
+
:public_folder # => path to public folder for the application. (default: File.join(root, 'public') )
|
54
|
+
:assets_prefix # => currently does nothing useful (default: 'assets')
|
55
|
+
:asset_host # => used by Sprockets::Helpers to return asset path prefixed by asset_host uri (default: nil)
|
56
|
+
:digest_assets # => enable digest version of assets? true or false (default: false)
|
57
|
+
:css_compressor # => instance of a sprokets compatible css compressor class (default: ::YUI::CssCompressor.new)
|
58
|
+
:js_compressor # => instance of a sprokets compatible js compressor class (default: ::Uglifier.new)
|
59
|
+
:sprockets # => instance of Sprockets::Environment. Should almost never need to be set manually. (default: Sprockets::Environment.new(root) )
|
60
|
+
````
|
61
|
+
## Project Status
|
20
62
|
|
21
|
-
|
63
|
+
- Build: [](https://travis-ci.org/styleseek/classy_assets)
|
64
|
+
- Code Quality: [](https://codeclimate.com/github/styleseek/classy_assets)
|
65
|
+
- Dependencies: [](https://gemnasium.com/styleseek/classy_assets)
|
22
66
|
|
23
67
|
## Contributing
|
24
68
|
|
@@ -6,9 +6,7 @@ require 'rack/classy_assets'
|
|
6
6
|
class MiddlewareApp < Sinatra::Base
|
7
7
|
set :root, File.expand_path('../../support', __FILE__)
|
8
8
|
set :public_folder, File.join(settings.root, 'public')
|
9
|
-
|
10
|
-
use Rack::ClassyAssets, root: settings.root,
|
11
|
-
sprockets: settings.sprockets
|
9
|
+
use Rack::ClassyAssets, root: settings.root
|
12
10
|
end
|
13
11
|
|
14
12
|
describe Rack::ClassyAssets do
|