lux_assets 0.2.14 → 0.2.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.version +1 -1
- data/lib/lux_assets/asset.rb +2 -0
- data/lib/lux_assets/cli.rb +5 -1
- data/lib/lux_assets/element.rb +17 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a981569c1fe2a2bf9f9fb8caf7a73a5987af1e21d06f5ba9e5b29ad27f8931f
|
4
|
+
data.tar.gz: 6cf4469a3657a33b722248803a46ef1e0ab224ca34db7bd45ddfcd6c60534b81
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0b1dd8f817de916961284e73021e610904a3fda24cf5286d58c2723ac7f1ab347442f5e2362971b1ae4baf296a8ef64310065b19711ba374ce8abb60d8c58dd
|
7
|
+
data.tar.gz: d01039bc7edcd6f038ac6fbd4f9d98fbe9fdc73c16470edd00cd2633dedec96e4372b91da1dd3b3d9b16e350841b3d7fb2e97292f70d6f49a3e18059c8cb4f35
|
data/.version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.15
|
data/lib/lux_assets/asset.rb
CHANGED
data/lib/lux_assets/cli.rb
CHANGED
@@ -15,8 +15,12 @@ module LuxAssets::Cli
|
|
15
15
|
puts text
|
16
16
|
end
|
17
17
|
|
18
|
+
def info text
|
19
|
+
puts text.yellow
|
20
|
+
end
|
21
|
+
|
18
22
|
def run what, opts={}
|
19
|
-
|
23
|
+
info (opts[:message] || what)
|
20
24
|
|
21
25
|
stdin, stdout, stderr, wait_thread = Open3.popen3(what)
|
22
26
|
|
data/lib/lux_assets/element.rb
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
# One file that can be scss, js, coffee, ts, etc...
|
2
2
|
|
3
|
+
require 'erb'
|
4
|
+
|
3
5
|
class LuxAssets::Element
|
4
6
|
|
5
7
|
def initialize source
|
6
|
-
@source = Pathname.new source
|
8
|
+
@source = @cache_source = Pathname.new source
|
7
9
|
|
8
|
-
|
9
|
-
|
10
|
-
@cache = Pathname.new './tmp/assets/%s' %
|
10
|
+
@target = source.sub(/^\.\//, '').sub(/^\//, '').gsub('/', '-')
|
11
|
+
@target = '%s-%s' % [@production ? :p : :d, @target] if content_type == 'text/css'
|
12
|
+
@cache = Pathname.new './tmp/assets/%s' % @target
|
11
13
|
end
|
12
14
|
|
13
15
|
def content_type
|
@@ -21,7 +23,7 @@ class LuxAssets::Element
|
|
21
23
|
method_name = 'compile_%s' % @source.to_s.split('.').last.downcase
|
22
24
|
|
23
25
|
if respond_to?(method_name, true)
|
24
|
-
(!force && cached) || send(method_name)
|
26
|
+
(!force && cached) || ( process_erb; send(method_name))
|
25
27
|
else
|
26
28
|
@source.read
|
27
29
|
end
|
@@ -32,7 +34,16 @@ class LuxAssets::Element
|
|
32
34
|
private
|
33
35
|
|
34
36
|
def cached
|
35
|
-
@cache.exist? && (@cache.ctime > @
|
37
|
+
@cache.exist? && (@cache.ctime > @cache_source.ctime) ? @cache.read : false
|
38
|
+
end
|
39
|
+
|
40
|
+
def process_erb
|
41
|
+
data = @source.read
|
42
|
+
if data.include?('<%=') && data.include?('%>')
|
43
|
+
LuxAssets::Cli.info 'Compile ERB: %s' % @source
|
44
|
+
@source = Pathname.new './tmp/assets/erb-' + @target
|
45
|
+
@source.write ERB.new(data).result
|
46
|
+
end
|
36
47
|
end
|
37
48
|
|
38
49
|
def compile_coffee
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lux_assets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dino Reic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|