partial_compiler 0.0.3 → 0.0.4
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/partial_compiler/plugin.rb +8 -4
- data/lib/partial_compiler/version.rb +1 -1
- data/lib/partial_compiler.rb +6 -1
- data/lib/tasks/partial_compiler_tasks.rake +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ecb61c73e1e6b3b596587d301227d2d8297ec7d1
|
4
|
+
data.tar.gz: 9b314598fae54a39c4ce82c31e314a8bda466c1f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54d58d29f2860e9094c576874293deefca96db78a87e7de3ec2e13037e367ed4dba4dd49f23a4c69d6fc4659190dd862dfe680d1d8789ea6adcc47f1c9023935
|
7
|
+
data.tar.gz: 9a2fd94ac7b1048e9d0c5ec1daee36dea90c200634b0dca347a338f227c9f511220fdc6e5347fc0478e52822c484fc06e35e3aa82a057b4340363569f980538e
|
@@ -2,7 +2,7 @@ module PartialCompiler
|
|
2
2
|
class Plugin
|
3
3
|
def initialize
|
4
4
|
original_extension = PartialCompiler.config[:original_extension]
|
5
|
-
template_engine =
|
5
|
+
template_engine = get_template_engine
|
6
6
|
if !PartialCompiler.config[:run_compiled]
|
7
7
|
ActionView::Template.register_template_handler(
|
8
8
|
"uc.#{original_extension}".to_sym, "uncompiled.#{original_extension}".to_sym,
|
@@ -12,10 +12,14 @@ module PartialCompiler
|
|
12
12
|
ActionView::Template.register_template_handler("compiled.#{original_extension}".to_sym, template_engine.send(:new))
|
13
13
|
end
|
14
14
|
end
|
15
|
-
end
|
16
15
|
|
17
|
-
|
18
|
-
|
16
|
+
private
|
17
|
+
|
18
|
+
def get_template_engine
|
19
|
+
template_engine_class = PartialCompiler.config[:template_engine]
|
20
|
+
return "ActionView::Template::Handlers::#{template_engine_class}".constantize
|
21
|
+
end
|
19
22
|
end
|
23
|
+
|
20
24
|
end
|
21
25
|
|
data/lib/partial_compiler.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
module PartialCompiler
|
2
2
|
require 'partial_compiler/railtie' if defined?(Rails)
|
3
|
+
|
3
4
|
@config = {
|
4
|
-
template_engine:
|
5
|
+
template_engine: "ERB",
|
5
6
|
original_extension: "html.erb",
|
6
7
|
rendering_engine_partial_format: "= render partial:",
|
7
8
|
# This code would be the code that's executing inside your template, e.g. `render partial: 'my_partial'`
|
@@ -18,6 +19,10 @@ module PartialCompiler
|
|
18
19
|
def self.config
|
19
20
|
@config
|
20
21
|
end
|
22
|
+
|
23
|
+
def self.start
|
24
|
+
Plugin.new
|
25
|
+
end
|
21
26
|
end
|
22
27
|
|
23
28
|
require "partial_compiler/plugin"
|