haml_coffee_assets 1.18.0 → 1.20.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +1 -1
- data/lib/haml_coffee_assets/action_view/template_handler.rb +3 -2
- data/lib/haml_coffee_assets/configuration.rb +1 -1
- data/lib/haml_coffee_assets/rails/engine.rb +0 -44
- data/lib/haml_coffee_assets/transformer.rb +5 -5
- data/lib/haml_coffee_assets/version.rb +1 -1
- metadata +41 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 68c32a5b411d1824da4a40464e7e3773529cf9bf85bce568f16c32e79d5c77bf
|
4
|
+
data.tar.gz: 3cd98534f88665eff482c8b1236004a600de377928128491ab9fffdc879cc404
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d261f7279539e796fa3cc3848ba5a37ed9df444b31ee77aec5b76aa03a8f495db743190c38f243822571cf06da44cd4effb69886e33715b1359f0c838ef3429
|
7
|
+
data.tar.gz: 826f493ad75f8d6e7f563b3ab7eea7f2231999104d4433affa3d16299d759e378c04c063ceb5ed5a3a70598e26b41c94b6a391abc795732010fba3139888d721
|
data/README.md
CHANGED
@@ -94,7 +94,7 @@ removed.
|
|
94
94
|
|
95
95
|
When you give your templates the extension `.jst.hamlc`, Haml Coffee Assets will only generate the template function,
|
96
96
|
which then in turn will be further processed by the
|
97
|
-
[Sprocket JST processor](https://github.com/
|
97
|
+
[Sprocket JST processor](https://github.com/rails/sprockets/blob/master/lib/sprockets/jst_processor.rb). Because
|
98
98
|
Haml Coffee Assets will not generate the template, you can't use the AMD support, template name filter and the JST
|
99
99
|
namespace definition is more cumbersome compared to the Haml Coffee template generation.
|
100
100
|
|
@@ -3,7 +3,7 @@ module HamlCoffeeAssets
|
|
3
3
|
class TemplateHandler
|
4
4
|
DEPENDENCY_PATTERN = /(?:window\.)?JST(?:\[["']([\w\/]+)["']\]|\.(\w+))/
|
5
5
|
|
6
|
-
def self.call(template)
|
6
|
+
def self.call(template, _body = nil)
|
7
7
|
new(template).render
|
8
8
|
end
|
9
9
|
|
@@ -80,7 +80,8 @@ module HamlCoffeeAssets
|
|
80
80
|
partial_source(path),
|
81
81
|
path,
|
82
82
|
self.class,
|
83
|
-
virtual_path: partial_path(path)
|
83
|
+
virtual_path: partial_path(path),
|
84
|
+
locals: []
|
84
85
|
)
|
85
86
|
|
86
87
|
compiled << self.class.new(
|
@@ -38,7 +38,7 @@ module HamlCoffeeAssets
|
|
38
38
|
self.selfCloseTags = 'meta,img,link,br,hr,input,area,param,col,base'
|
39
39
|
self.context = 'window.HAML.context'
|
40
40
|
self.templates_path = 'app/assets/javascripts/templates'
|
41
|
-
self.global_context_asset = 'templates/context'
|
41
|
+
self.global_context_asset = 'templates/context.js'
|
42
42
|
self.name_filter = lambda { |n|
|
43
43
|
parts = n.sub(/^templates\//, '').split('/')
|
44
44
|
parts.last.sub!(/^_/, '')
|
@@ -33,50 +33,6 @@ module HamlCoffeeAssets
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
if ::Rails.env == "development"
|
37
|
-
# Monkey patch rails so it busts the server cache for templates
|
38
|
-
# depending on the global_context_asset.
|
39
|
-
#
|
40
|
-
# Currently, the only way to force rails to recompile a server template is to
|
41
|
-
# touch it. This is problematic because when the global_context_asset
|
42
|
-
# changes we need to manually touch every template that uses the congtext
|
43
|
-
# in some way.
|
44
|
-
#
|
45
|
-
# To ease development, make rails 'touch' and recompile hamlc templates
|
46
|
-
# when the global context has changed.
|
47
|
-
#
|
48
|
-
# Do this ONLY in development.
|
49
|
-
#
|
50
|
-
# TODO: Don't monkey patch rails.
|
51
|
-
module ::ActionView
|
52
|
-
class Template
|
53
|
-
def stale?
|
54
|
-
return false unless ::Rails.env == "development"
|
55
|
-
return false unless handler.respond_to?(:stale?)
|
56
|
-
handler.stale?(updated_at)
|
57
|
-
end
|
58
|
-
|
59
|
-
alias_method :old_render, :render
|
60
|
-
|
61
|
-
# by default, rails will only compile a template once
|
62
|
-
# path render so it recompiles the template if 'stale'
|
63
|
-
def render(view, locals, buffer=nil, &block)
|
64
|
-
if @compiled and stale?
|
65
|
-
now = Time.now
|
66
|
-
File.utime(now, now, identifier) # touch file
|
67
|
-
::Rails.logger.info "Busted cache for #{identifier} by touching it"
|
68
|
-
|
69
|
-
view = refresh(view)
|
70
|
-
@source = view.source
|
71
|
-
@compiled = false
|
72
|
-
end
|
73
|
-
old_render(view, locals, buffer, &block)
|
74
|
-
end
|
75
|
-
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
36
|
config.assets.configure do |env|
|
81
37
|
if env.respond_to?(:register_transformer)
|
82
38
|
env.register_mime_type 'text/hamlc', extensions: ['.hamlc']
|
@@ -10,23 +10,23 @@ module HamlCoffeeAssets
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def render(context, empty_hash_wtf)
|
13
|
-
self.class.run(@filename, @source, context)
|
13
|
+
self.class.run(@filename, @filename, @source, context)
|
14
14
|
end
|
15
15
|
|
16
|
-
def self.run(filename, source, context)
|
16
|
+
def self.run(filename, name, source, context)
|
17
17
|
jst = !!(filename =~ /\.jst\.hamlc(?:\.|$)/)
|
18
|
-
name = filename
|
19
18
|
name = HamlCoffeeAssets.config.name_filter.call(name) if HamlCoffeeAssets.config.name_filter && !jst
|
20
19
|
|
21
20
|
HamlCoffeeAssets::Compiler.compile(name, source, !jst)
|
22
21
|
end
|
23
22
|
|
24
23
|
def self.call(input)
|
25
|
-
filename = input[:
|
24
|
+
filename = input[:filename]
|
25
|
+
name = input[:name]
|
26
26
|
source = input[:data]
|
27
27
|
context = input[:environment].context_class.new(input)
|
28
28
|
|
29
|
-
result = run(filename, source, context)
|
29
|
+
result = run(filename, name, source, context)
|
30
30
|
context.metadata.merge(data: result)
|
31
31
|
end
|
32
32
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: haml_coffee_assets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.20.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Kessler
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2021-04-29 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: coffee-script
|
@@ -26,20 +26,40 @@ dependencies:
|
|
26
26
|
- - ">="
|
27
27
|
- !ruby/object:Gem::Version
|
28
28
|
version: '2'
|
29
|
+
- !ruby/object:Gem::Dependency
|
30
|
+
name: railties
|
31
|
+
requirement: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - ">="
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '4.2'
|
36
|
+
- - "<"
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '6.2'
|
39
|
+
type: :runtime
|
40
|
+
prerelease: false
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '4.2'
|
46
|
+
- - "<"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '6.2'
|
29
49
|
- !ruby/object:Gem::Dependency
|
30
50
|
name: sprockets
|
31
51
|
requirement: !ruby/object:Gem::Requirement
|
32
52
|
requirements:
|
33
53
|
- - ">="
|
34
54
|
- !ruby/object:Gem::Version
|
35
|
-
version: '
|
55
|
+
version: '3.7'
|
36
56
|
type: :runtime
|
37
57
|
prerelease: false
|
38
58
|
version_requirements: !ruby/object:Gem::Requirement
|
39
59
|
requirements:
|
40
60
|
- - ">="
|
41
61
|
- !ruby/object:Gem::Version
|
42
|
-
version: '
|
62
|
+
version: '3.7'
|
43
63
|
- !ruby/object:Gem::Dependency
|
44
64
|
name: bundler
|
45
65
|
requirement: !ruby/object:Gem::Requirement
|
@@ -222,6 +242,20 @@ dependencies:
|
|
222
242
|
- - ">="
|
223
243
|
- !ruby/object:Gem::Version
|
224
244
|
version: '0'
|
245
|
+
- !ruby/object:Gem::Dependency
|
246
|
+
name: puma
|
247
|
+
requirement: !ruby/object:Gem::Requirement
|
248
|
+
requirements:
|
249
|
+
- - ">="
|
250
|
+
- !ruby/object:Gem::Version
|
251
|
+
version: '0'
|
252
|
+
type: :development
|
253
|
+
prerelease: false
|
254
|
+
version_requirements: !ruby/object:Gem::Requirement
|
255
|
+
requirements:
|
256
|
+
- - ">="
|
257
|
+
- !ruby/object:Gem::Version
|
258
|
+
version: '0'
|
225
259
|
description: Compile Haml CoffeeScript templates in the Rails asset pipeline.
|
226
260
|
email:
|
227
261
|
- michi@flinkfinger.com
|
@@ -259,15 +293,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
259
293
|
requirements:
|
260
294
|
- - ">="
|
261
295
|
- !ruby/object:Gem::Version
|
262
|
-
version:
|
296
|
+
version: '2.5'
|
263
297
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
264
298
|
requirements:
|
265
299
|
- - ">="
|
266
300
|
- !ruby/object:Gem::Version
|
267
|
-
version:
|
301
|
+
version: 2.5.2
|
268
302
|
requirements: []
|
269
|
-
|
270
|
-
rubygems_version: 2.6.10
|
303
|
+
rubygems_version: 3.0.9
|
271
304
|
signing_key:
|
272
305
|
specification_version: 4
|
273
306
|
summary: Haml CoffeeScript templates
|