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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f3662ced6ffcf775e15fdd109d8f15b2b0a7b252aeb80f94678160ef4d7b4a91
4
- data.tar.gz: f8b1f37e251e7e86846ca35d816e6d3ff8bafafe43fbdda9a1387fabaee0f2ef
3
+ metadata.gz: 4a981569c1fe2a2bf9f9fb8caf7a73a5987af1e21d06f5ba9e5b29ad27f8931f
4
+ data.tar.gz: 6cf4469a3657a33b722248803a46ef1e0ab224ca34db7bd45ddfcd6c60534b81
5
5
  SHA512:
6
- metadata.gz: f928778dae5c59e5e7eac6742ac3000a13514ec9d8d9ee541c47477c69242aaf668b0ca7a10324c1697c7d2b12e345b4848968a566c4fad664ff75139b608c28
7
- data.tar.gz: 7542dfcb92872f9aa14a3a7239be850f2b4054cb7d039862444667463b244c297ce16e3ad35c883d861cda821b47ef96c36d73ccf7bd5f03cccbdd6ab359d0c6
6
+ metadata.gz: c0b1dd8f817de916961284e73021e610904a3fda24cf5286d58c2723ac7f1ab347442f5e2362971b1ae4baf296a8ef64310065b19711ba374ce8abb60d8c58dd
7
+ data.tar.gz: d01039bc7edcd6f038ac6fbd4f9d98fbe9fdc73c16470edd00cd2633dedec96e4372b91da1dd3b3d9b16e350841b3d7fb2e97292f70d6f49a3e18059c8cb4f35
data/.version CHANGED
@@ -1 +1 @@
1
- 0.2.14
1
+ 0.2.15
@@ -1,5 +1,7 @@
1
1
  # Asset group, single asset that produces target css or js
2
2
 
3
+ require 'erb'
4
+
3
5
  class LuxAssets::Asset
4
6
 
5
7
  def initialize ext, name
@@ -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
- puts (opts[:message] || what).yellow
23
+ info (opts[:message] || what)
20
24
 
21
25
  stdin, stdout, stderr, wait_thread = Open3.popen3(what)
22
26
 
@@ -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
- source = source.sub(/^\.\//, '').sub(/^\//, '').gsub('/', '-')
9
- source = '%s-%s' % [@production ? :p : :d, source] if content_type == 'text/css'
10
- @cache = Pathname.new './tmp/assets/%s' % source
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 > @source.ctime) ? @cache.read : false
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.14
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: 2018-11-15 00:00:00.000000000 Z
11
+ date: 2019-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize