sinatra-asset-pipeline 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +4 -4
- data/lib/sinatra/asset_pipeline.rb +7 -12
- data/lib/sinatra/asset_pipeline/version.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -25,7 +25,7 @@ require './app'
|
|
25
25
|
Sinatra::AssetPipeline::Task.define! App
|
26
26
|
```
|
27
27
|
|
28
|
-
Now, when everything is in place you can precompile assets with:
|
28
|
+
Now, when everything is in place you can precompile assets located in `assets/<asset-type>` with:
|
29
29
|
|
30
30
|
```bash
|
31
31
|
$ rake assets:precompile
|
@@ -39,7 +39,7 @@ $ rake assets:clean
|
|
39
39
|
|
40
40
|
# Example
|
41
41
|
|
42
|
-
In it's most simple form you just register the `Sinatra::AssetPipeline` Sinatra extension within your Sinatra app
|
42
|
+
In it's most simple form you just register the `Sinatra::AssetPipeline` Sinatra extension within your Sinatra app:
|
43
43
|
|
44
44
|
```ruby
|
45
45
|
Bundler.require
|
@@ -100,7 +100,7 @@ body {
|
|
100
100
|
|
101
101
|
### CSS and JavaScript minification
|
102
102
|
|
103
|
-
If you would like to use CSS and/or JavaScript minification make sure to require the gems needed in your `Gemfile
|
103
|
+
If you would like to use CSS and/or JavaScript minification make sure to require the gems needed in your `Gemfile`:
|
104
104
|
|
105
105
|
<table>
|
106
106
|
<tr>
|
@@ -127,5 +127,5 @@ If you would like to use CSS and/or JavaScript minification make sure to require
|
|
127
127
|
|
128
128
|
### Compass integration
|
129
129
|
|
130
|
-
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.
|
130
|
+
Given that we're using [sprockets-sass](https://github.com/petebrowne/sprockets-sass) under the hood we have out of the box support for [compass](https://github.com/chriseppstein/compass). Just include the compass gem in your `Gemfile` and include the compass mixins in your `app.css.scss` file.
|
131
131
|
|
@@ -19,8 +19,10 @@ module Sinatra
|
|
19
19
|
|
20
20
|
app.configure do
|
21
21
|
app.assets_prefix.each do |prefix|
|
22
|
-
Dir[File.join
|
22
|
+
paths = Dir[File.join(prefix, '*')]
|
23
|
+
paths.each { |path| app.sprockets.append_path path }
|
23
24
|
end
|
25
|
+
|
24
26
|
Sprockets::Helpers.configure do |config|
|
25
27
|
config.environment = app.sprockets
|
26
28
|
config.digest = app.assets_digest
|
@@ -46,10 +48,10 @@ module Sinatra
|
|
46
48
|
app.helpers Sprockets::Helpers
|
47
49
|
|
48
50
|
app.configure :test, :development do
|
49
|
-
app.get
|
50
|
-
|
51
|
-
|
52
|
-
|
51
|
+
app.get "#{Sprockets::Helpers.prefix}/*" do |path|
|
52
|
+
env_sprockets = request.env.dup
|
53
|
+
env_sprockets['PATH_INFO'] = path
|
54
|
+
settings.sprockets.call env_sprockets
|
53
55
|
end
|
54
56
|
end
|
55
57
|
end
|
@@ -57,12 +59,5 @@ module Sinatra
|
|
57
59
|
def set_default(key, default)
|
58
60
|
self.set(key, default) unless self.respond_to? key
|
59
61
|
end
|
60
|
-
|
61
|
-
# Look for asset in Sprockets
|
62
|
-
# If not found try without digest
|
63
|
-
def find_asset(source)
|
64
|
-
sprockets.find_asset(source) ||
|
65
|
-
sprockets.find_asset(source.gsub(/(-\w+)(?!.*-\w+)/, ''))
|
66
|
-
end
|
67
62
|
end
|
68
63
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-asset-pipeline
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-11-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|