sinatra-asset-pipeline 0.1.0 → 0.1.1
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 +8 -8
- data/README.md +74 -1
- data/lib/sinatra/asset_pipeline.rb +1 -1
- data/lib/sinatra/asset_pipeline/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OGE1NDcwY2M4NDhhMDA2YTI4OTA0NzJlZDM2YTFkMTIwNDI1NGFiZg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
Yjc4N2U0OTFhYjg5ZjYxMGE3NTU1OTQ3MzUxMTJhNDM4YWU2YzdjYw==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZGRkOTBhMzQzYWM2ZDY0OGYzZWExZWU2MDg3MzI3NDhiZmYyNDA2YmM1ZTFh
|
10
|
+
NDk3YTk1NWM4NzQ1YTlmMWZjZTdkOWY0OWEwMzE2NzYwZjQzZDU1MWFjOTA2
|
11
|
+
MGZmYzE1OWIxZTIxODYyYzM2MGRmZjAzOTc2NzY5ZDg4NTU3Zjg=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MDA2ZjRiZmNiMjg4NzA5OTY5MGYyNTc3N2VmN2E1ODA4M2NiMDEzNTVhMjdk
|
14
|
+
YWQ3YzdjODc4YTVlOTQ1NGZhMTRiZGFkNjc4MDdiYTNmNzU4ZDE2ZWNmMGJl
|
15
|
+
ZmM5ZWUxNjY1ZTA1NTNlNTE1ODFhMWFjMWU5NTVjMjMxMTUxZjE=
|
data/README.md
CHANGED
@@ -1 +1,74 @@
|
|
1
|
-
#
|
1
|
+
# sinatra-asset-pipeline
|
2
|
+
|
3
|
+
An asset pipeline implementation for Sinatra based on Sprockets including HAML, SASS and CoffeeScript support.
|
4
|
+
|
5
|
+
# Installation
|
6
|
+
|
7
|
+
Install sinatra-asset-pipeline from RubyGems:
|
8
|
+
|
9
|
+
$ gem install sinatra-asset-pipeline
|
10
|
+
|
11
|
+
Or include it in your project's Gemfile with Bundler:
|
12
|
+
|
13
|
+
gem 'sinatra-asset-pipeline'
|
14
|
+
|
15
|
+
Make sure to add the sinatra-asset-pipeline Rake task in your applications Rakefile:
|
16
|
+
|
17
|
+
require 'sinatra/asset_pipeline/task.rb'
|
18
|
+
require './app'
|
19
|
+
|
20
|
+
Sinatra::AssetPipeline::Task.define! App
|
21
|
+
|
22
|
+
Now, when everything is in place you can precompile assets with:
|
23
|
+
|
24
|
+
rake assets:precompile
|
25
|
+
|
26
|
+
And remove old compiled assets with:
|
27
|
+
|
28
|
+
rake assets:clean
|
29
|
+
|
30
|
+
# Example
|
31
|
+
|
32
|
+
In it's most simple form you just register the Sinatra::AssetPipe Sinatra extension within your Sinatra app.
|
33
|
+
|
34
|
+
Bundler.require
|
35
|
+
|
36
|
+
require 'sinatra/asset_pipeline'
|
37
|
+
|
38
|
+
class App < Sinatra::Base
|
39
|
+
register Sinatra::AssetPipeline
|
40
|
+
|
41
|
+
get '/' do
|
42
|
+
haml :index
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
However, if you want to be more fancy, you can customize almost all aspects of sinatra-asset-pipeline. Here is a more elaborate example.
|
47
|
+
|
48
|
+
Bundler.require
|
49
|
+
|
50
|
+
require 'sinatra/asset_pipeline'
|
51
|
+
|
52
|
+
class App < Sinatra::Base
|
53
|
+
register Sinatra::AssetPipeline
|
54
|
+
|
55
|
+
# Which files should be included in the precompile
|
56
|
+
set :assets_precompile, %w(app.js app.css *.png *.jpg *.svg *.eot *.ttf *.woff)
|
57
|
+
|
58
|
+
# Where are the assets located
|
59
|
+
set :assets_prefix, 'assets'
|
60
|
+
|
61
|
+
# Which protocol should we use to serve assets
|
62
|
+
set :assets_protocol, 'http'
|
63
|
+
|
64
|
+
get '/' do
|
65
|
+
haml :index
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
Now when everything is in place you can use all helpers provided by [sprockets-helpers](https://github.com/petebrowne/sprockets-helpers), here is a small example:
|
70
|
+
|
71
|
+
body {
|
72
|
+
background-image: image-url('cat.png');
|
73
|
+
}
|
74
|
+
|
@@ -8,10 +8,10 @@ module Sinatra
|
|
8
8
|
app.set_default :assets_precompile, %w(app.js app.css *.png *.jpg *.svg *.eot *.ttf *.woff)
|
9
9
|
app.set_default :assets_prefix, 'assets'
|
10
10
|
app.set_default :assets_path, -> { File.join(public_folder, assets_prefix) }
|
11
|
-
app.set_default :assets_digest, true
|
12
11
|
app.set_default :assets_protocol, 'http'
|
13
12
|
|
14
13
|
app.set :static, true
|
14
|
+
app.set :assets_digest, true
|
15
15
|
app.set :static_cache_control, [:public, :max_age => 525600]
|
16
16
|
|
17
17
|
app.configure do
|