roda-opal_assets 0.1.1 → 0.1.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/lib/roda/opal_assets/version.rb +1 -1
- data/lib/roda/opal_assets.rb +17 -2
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cccf69690efc631f7a20ab500ad87d494cb871d5
|
|
4
|
+
data.tar.gz: 63bef0edc65e54e1c488b07d26dbf8c2aff73975
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dac68610e9b37726f83de1502a6bfd2c28be571efe837a24686444abe2e600e07cb63444a717e3ee9a4e11f793709ff69b619633c521c9d20e6b13c96e4e2f76
|
|
7
|
+
data.tar.gz: 38620aae23d1a814effcb79c12bf2cc487f0822f80f0e84ab7c9622b76f65334aefab64af872765aa9600b1a73a862ca56b6c63824799538bf2d44e745704805
|
data/lib/roda/opal_assets.rb
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
require "roda/opal_assets/version"
|
|
2
2
|
require "roda"
|
|
3
|
+
require "opal"
|
|
3
4
|
|
|
4
5
|
class Roda
|
|
5
6
|
class OpalAssets
|
|
7
|
+
def initialize env: ENV['RACK_ENV']
|
|
8
|
+
@env = env
|
|
9
|
+
|
|
10
|
+
Opal::Config.source_map_enabled = !production?
|
|
11
|
+
sprockets
|
|
12
|
+
source_maps
|
|
13
|
+
end
|
|
14
|
+
|
|
6
15
|
def route r
|
|
7
16
|
r.on source_map_prefix[1..-1] do
|
|
8
17
|
r.run source_maps
|
|
@@ -20,7 +29,7 @@ class Roda
|
|
|
20
29
|
file,
|
|
21
30
|
sprockets: sprockets,
|
|
22
31
|
prefix: '/assets/js',
|
|
23
|
-
debug:
|
|
32
|
+
debug: !production?,
|
|
24
33
|
)
|
|
25
34
|
end
|
|
26
35
|
|
|
@@ -55,7 +64,9 @@ class Roda
|
|
|
55
64
|
return @source_maps if defined? @source_maps
|
|
56
65
|
|
|
57
66
|
source_maps = Opal::SourceMapServer.new(sprockets, source_map_prefix)
|
|
58
|
-
|
|
67
|
+
unless production?
|
|
68
|
+
::Opal::Sprockets::SourceMapHeaderPatch.inject!(p source_map_prefix)
|
|
69
|
+
end
|
|
59
70
|
|
|
60
71
|
@source_maps = Rack::Builder.new do
|
|
61
72
|
use Rack::ConditionalGet
|
|
@@ -64,5 +75,9 @@ class Roda
|
|
|
64
75
|
run source_maps
|
|
65
76
|
end
|
|
66
77
|
end
|
|
78
|
+
|
|
79
|
+
def production?
|
|
80
|
+
@env == 'production'
|
|
81
|
+
end
|
|
67
82
|
end
|
|
68
83
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: roda-opal_assets
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jamie Gaskins
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-07-
|
|
11
|
+
date: 2016-07-04 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: opal
|