sinatra-asset-pipeline 0.1.3 → 0.2.0
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 +40 -10
- data/lib/sinatra/asset_pipeline.rb +5 -2
- data/lib/sinatra/asset_pipeline/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MGE0MWMwMjQ5NTNmZTI3NTI2ZWU3MzVmZmRmNGQwMmY0MjJjNjlkYQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZDE1MTAyYjRhMTFjZDM3MWZiZDYwMTVjMzk0ZjRlZGUyY2QxMmU1Nw==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NDg5YTk3OGRlMWFmZDEwNzQ3ZTViMDFkNWY4NGViODU1ZWJhZjZiZjkwNWI0
|
10
|
+
YzVlMjJlZmNmNzRkODU1NTQxYmY5MWI1NTBhMzAzYmU5M2VjOWZiMjY1OWQ4
|
11
|
+
ZmI5M2MxOGVkNWFiNTgzMTRkNzU5NGE3MjA3MDMyZmRlYTUxNTc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ODAxMDlhMzkxMDFlM2RmNWQ1YjdmMDA0MjdiZjQ0NGMxNWNhNDY2NjY2YTNi
|
14
|
+
MDYxMzAwYmE3MmJhNGI3MmUxYzM5YThiYzU2YmU5NjNmODM2NTYzZTcyOTg5
|
15
|
+
NTExYTFmODgzYjY3YjQzZDg3ZmQ1OTM2YzQ1NjFiMTI1YTZlMzI=
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# sinatra-asset-pipeline
|
2
2
|
|
3
|
-
An asset pipeline implementation for Sinatra based on Sprockets with support for SASS,
|
3
|
+
An asset pipeline implementation for Sinatra based on [Sprockets](https://github.com/sstephenson/sprockets) with support for CoffeeScript, SASS, SCSS, LESS, ERB as well as CSS (SASS, YUI) and JavaScript (uglifier, YUI, Closure) minification.
|
4
4
|
|
5
5
|
# Installation
|
6
6
|
|
@@ -12,7 +12,7 @@ Or include it in your project's Gemfile with Bundler:
|
|
12
12
|
|
13
13
|
gem 'sinatra-asset-pipeline'
|
14
14
|
|
15
|
-
Make sure to add the sinatra-asset-pipeline Rake task in your applications Rakefile
|
15
|
+
Make sure to add the sinatra-asset-pipeline Rake task in your applications `Rakefile`:
|
16
16
|
|
17
17
|
require 'sinatra/asset_pipeline/task.rb'
|
18
18
|
require './app'
|
@@ -21,15 +21,15 @@ Make sure to add the sinatra-asset-pipeline Rake task in your applications Rakef
|
|
21
21
|
|
22
22
|
Now, when everything is in place you can precompile assets with:
|
23
23
|
|
24
|
-
rake assets:precompile
|
24
|
+
$ rake assets:precompile
|
25
25
|
|
26
26
|
And remove old compiled assets with:
|
27
27
|
|
28
|
-
rake assets:clean
|
28
|
+
$ rake assets:clean
|
29
29
|
|
30
30
|
# Example
|
31
31
|
|
32
|
-
In it's most simple form you just register the Sinatra::AssetPipe Sinatra extension within your Sinatra app.
|
32
|
+
In it's most simple form you just register the `Sinatra::AssetPipe` Sinatra extension within your Sinatra app.
|
33
33
|
|
34
34
|
Bundler.require
|
35
35
|
|
@@ -62,8 +62,11 @@ However, if your application doesn't follow the defaults you can customize it as
|
|
62
62
|
# Serve assets using this protocol
|
63
63
|
set :assets_protocol, :http
|
64
64
|
|
65
|
-
#
|
66
|
-
set :
|
65
|
+
# CSS minification
|
66
|
+
set :assets_css_compressor, :sass
|
67
|
+
|
68
|
+
# JavaScript minification
|
69
|
+
set :assets_js_minification, :uglifier
|
67
70
|
|
68
71
|
register Sinatra::AssetPipeline
|
69
72
|
|
@@ -78,7 +81,34 @@ Now when everything is in place you can use all helpers provided by [sprockets-h
|
|
78
81
|
background-image: image-url('cat.png');
|
79
82
|
}
|
80
83
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
+
### CSS and JavaScript minification
|
85
|
+
|
86
|
+
If you would like to use CSS and/or JavaScript minification make sure to require the gems needed in your `Gemfile`.
|
87
|
+
|
88
|
+
<table>
|
89
|
+
<tr>
|
90
|
+
<th>Minifier</th>
|
91
|
+
<th>Gem</th>
|
92
|
+
</tr>
|
93
|
+
<tr>
|
94
|
+
<td>:sass</td>
|
95
|
+
<td>sass</td>
|
96
|
+
</tr>
|
97
|
+
<tr>
|
98
|
+
<td>:closure</td>
|
99
|
+
<td>closure-compiler</td>
|
100
|
+
</tr>
|
101
|
+
<tr>
|
102
|
+
<td>:uglifier</td>
|
103
|
+
<td>uglifier</td>
|
104
|
+
</tr>
|
105
|
+
<tr>
|
106
|
+
<td>:yui</td>
|
107
|
+
<td>yui-compressor</td>
|
108
|
+
</tr>
|
109
|
+
</table>
|
110
|
+
|
111
|
+
### Compass integration
|
112
|
+
|
113
|
+
Given that we're using [sprockets-sass](https://github.com/petebrowne/sprockets-sass) we have out of the box support for compass. Just include the compass gem in your `Gemfile` and include the compass mixins in your `app.css.scss` file.
|
84
114
|
|
@@ -10,7 +10,8 @@ module Sinatra
|
|
10
10
|
app.set_default :assets_prefix, 'assets'
|
11
11
|
app.set_default :assets_path, -> { File.join(public_folder, assets_prefix) }
|
12
12
|
app.set_default :assets_protocol, :http
|
13
|
-
app.set_default :
|
13
|
+
app.set_default :assets_css_compressor, :none
|
14
|
+
app.set_default :assets_js_compressor, :none
|
14
15
|
|
15
16
|
app.set :static, true
|
16
17
|
app.set :assets_digest, true
|
@@ -32,7 +33,9 @@ module Sinatra
|
|
32
33
|
end
|
33
34
|
|
34
35
|
app.configure :production do
|
35
|
-
|
36
|
+
app.sprockets.css_compressor = app.assets_css_compressor unless app.assets_css_compressor == :none
|
37
|
+
app.sprockets.js_compressor = app.assets_js_compressor unless app.assets_js_compressor == :none
|
38
|
+
|
36
39
|
Sprockets::Helpers.configure do |config|
|
37
40
|
config.protocol = app.assets_protocol
|
38
41
|
config.asset_host = app.assets_host if app.respond_to? :assets_host
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-asset-pipeline
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joakim Ekberg
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-04-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|