sinatra-asset-snack 0.1.4 → 0.1.5
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/Gemfile.lock +2 -0
- data/README.md +12 -12
- data/lib/sinatra/asset_snack.rb +1 -0
- data/lib/sinatra/asset_snack/asset_snack.rb +2 -1
- data/lib/sinatra/asset_snack/compilers/coffee_script_compiler.rb +1 -1
- data/lib/sinatra/asset_snack/version.rb +1 -1
- data/sinatra-asset-snack.gemspec +1 -0
- data/test/asset_snack_test.rb +6 -1
- data/test/compilers/coffee_script_compiler_test.rb +1 -1
- data/test/fixtures/test.js +1 -0
- data/test/test_helper.rb +1 -0
- metadata +16 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YzMxNmMwNWNjMzAwMTIwODk5NmMyZTJlMzdiZWFhYjNmM2MzZDU1YQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MGU2ZGI1NWI4ZTdiNGUwNTg2MjE3NzE4ZTYzMGNlNDgzZDU4YzliNQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZGVhNDVjZjY0MjEwMzM1NzY3NTViYjNiZTk3NmE0OTBlZjQ0Y2I2NWY4YjZl
|
10
|
+
ODkwYjZjM2Q0Zjk5ODM4ZmU1ZTc1OGUwN2ZiMjM2YTRiOTE5ZGFhYTU4MDM3
|
11
|
+
ZDQyNGFiNjdmM2RiYzU3YjQ4MDJmMDkyOGZiMzc5MDJiNWJhZTM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NTM5MzhjZjJlMjgyZGUzNTJjMzY5MjBjNDMzMDgxY2FlZWM4OGNjM2FmYzli
|
14
|
+
MWViN2ZmNzk4MDFlNTQ4MDExMTFiNzUzOWYyNWNhYzUwOTk0NTZmMjlkOTE0
|
15
|
+
YTVhMmU3N2QwYmMxNWRlZjNlNjc2MDgzNjNmMjYwMWRiYmE0ODc=
|
data/Gemfile.lock
CHANGED
@@ -3,6 +3,7 @@ PATH
|
|
3
3
|
specs:
|
4
4
|
sinatra-asset-snack (0.1.4)
|
5
5
|
coffee-script
|
6
|
+
mime-types
|
6
7
|
sass
|
7
8
|
sinatra
|
8
9
|
|
@@ -19,6 +20,7 @@ GEM
|
|
19
20
|
multi_json (~> 1.0)
|
20
21
|
hashie (2.0.3)
|
21
22
|
metaclass (0.0.1)
|
23
|
+
mime-types (1.21)
|
22
24
|
minitest (4.7.0)
|
23
25
|
minitest-reporters (0.14.11)
|
24
26
|
ansi
|
data/README.md
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# AssetSnack for Sinatra
|
2
2
|
|
3
|
+
[](https://travis-ci.org/benkitzelman/sinatra-asset-snack)
|
4
|
+
[](http://badge.fury.io/rb/sinatra-asset-snack)
|
5
|
+
|
3
6
|
A lean asset compiler for Sinatra developed specifically for Coffeescript and SASS.
|
4
7
|
It stitches all assets for a route into a single file, no uglification, no minification (configure your server to use Gzip),
|
5
8
|
just lean, fast compilation.
|
6
9
|
|
7
|
-
[](https://travis-ci.org/benkitzelman/sinatra-asset-snack)
|
8
|
-
[](http://badge.fury.io/rb/sinatra-asset-snack)
|
9
|
-
|
10
10
|
## Installation
|
11
11
|
### Bundler users
|
12
12
|
|
@@ -16,10 +16,9 @@ If you use Bundler, add it to your *Gemfile.*
|
|
16
16
|
gem install sinatra-asset-snack
|
17
17
|
```
|
18
18
|
|
19
|
-
|
20
19
|
## Setup
|
21
20
|
|
22
|
-
|
21
|
+
Require and register the gem then configure your routes.
|
23
22
|
|
24
23
|
``` ruby
|
25
24
|
require 'sinatra/asset_snack'
|
@@ -48,14 +47,15 @@ If you want - use the helpers to add cache busting
|
|
48
47
|
Configuration options may be passed into each compiler. For example
|
49
48
|
|
50
49
|
``` ruby
|
51
|
-
Sinatra::AssetSnack.
|
52
|
-
|
53
|
-
config.compilers[:sass] = {syntax: :scss}
|
54
|
-
end
|
50
|
+
Sinatra::AssetSnack.configuration.compilers[:coffee_script] = {bare: true}
|
51
|
+
Sinatra::AssetSnack.configuration.compilers[:sass] = {syntax: :scss}
|
55
52
|
```
|
56
53
|
|
57
54
|
See each compiler's repo for the list of configuration options
|
58
55
|
|
59
|
-
|
60
|
-
[
|
61
|
-
|
56
|
+
|
57
|
+
[sinatra](http://sinatrarb.com)
|
58
|
+
|
59
|
+
[coffee-script](http://github.com/josh/ruby-coffee-script)
|
60
|
+
|
61
|
+
[sass](http://sass-lang.com/)
|
data/lib/sinatra/asset_snack.rb
CHANGED
@@ -3,7 +3,7 @@ module Sinatra
|
|
3
3
|
module Compilers
|
4
4
|
class CoffeeScriptCompiler < AssetCompiler
|
5
5
|
handle_extensions :coffee
|
6
|
-
mime_type '
|
6
|
+
mime_type 'application/javascript'
|
7
7
|
|
8
8
|
def compile(coffee_script, file_path = nil)
|
9
9
|
CoffeeScript.compile(coffee_script, self.class.configuration)
|
data/sinatra-asset-snack.gemspec
CHANGED
data/test/asset_snack_test.rb
CHANGED
@@ -17,7 +17,12 @@ module Sinatra
|
|
17
17
|
|
18
18
|
it 'should return the compilers mime type as a header' do
|
19
19
|
get '/javascript/application.js'
|
20
|
-
last_response.headers['Content-Type'].must_equal '
|
20
|
+
last_response.headers['Content-Type'].must_equal 'application/javascript'
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'should return file mime_type for uncompiled assets' do
|
24
|
+
get '/javascript/application_js_only.js'
|
25
|
+
last_response.headers['Content-Type'].must_equal 'application/javascript'
|
21
26
|
end
|
22
27
|
|
23
28
|
it 'should allow compiler configuration' do
|
@@ -0,0 +1 @@
|
|
1
|
+
function() { var x = 'test'; }
|
data/test/test_helper.rb
CHANGED
@@ -12,5 +12,6 @@ class App < Sinatra::Base
|
|
12
12
|
register Sinatra::AssetSnack
|
13
13
|
|
14
14
|
asset_map '/javascript/application.js', ['test/fixtures/**/*.coffee']
|
15
|
+
asset_map '/javascript/application_js_only.js', ['test/fixtures/**/*.js']
|
15
16
|
asset_map '/stylesheets/application.css', ['test/fixtures/**/*.scss']
|
16
17
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-asset-snack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Kitzelman
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - ! '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: mime-types
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ! '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: minitest
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -151,6 +165,7 @@ files:
|
|
151
165
|
- test/compilers/sass_compiler_test.rb
|
152
166
|
- test/configuration_test.rb
|
153
167
|
- test/fixtures/test.coffee
|
168
|
+
- test/fixtures/test.js
|
154
169
|
- test/fixtures/test.sass
|
155
170
|
- test/fixtures/test.scss
|
156
171
|
- test/fixtures/test_two.coffee
|