haml_coffee_template 0.1.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/haml_coffee_template/compiler.rb +10 -7
- data/lib/haml_coffee_template/configuration.rb +4 -3
- data/lib/haml_coffee_template/{hamlcoffee.js → haml-coffee.js} +7 -0
- data/lib/haml_coffee_template/version.rb +1 -1
- data/lib/haml_coffee_template/wrapper.js +6 -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: 25253658003a616ec94436a111f18ad24bd6d79285e9a2e15c2934053fcb47cd
|
4
|
+
data.tar.gz: 7dfbbe053afeec88e0beeec03a683807f481613b43dc3e0b93b3c225bd2ee1fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 569d4b227b85da8084c0bc6b93ecc17d666c716c53d14ad1ba1e95069b5242ade11a79e4493144b654702939e739ae65e3ac0b832bca46a04b4a07ea4e4ff943
|
7
|
+
data.tar.gz: 9a3d3411a34dd43b405c3f780f6b38dd760621de58da5fc09abb8624579b7976b95a19af75dfafd6a3ab6ad4c7ebf544dd85e28074b99ce45adda980ca73caa8
|
@@ -9,12 +9,14 @@ module HamlCoffeeTemplate
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def template(name, source)
|
12
|
+
haml_coffee_compiler_options = HamlCoffeeTemplate.configuration.haml_coffee_compiler_options.dup
|
13
|
+
haml_coffee_compiler_options[:name] = name
|
14
|
+
haml_coffee_compiler_options[:namespace] = HamlCoffeeTemplate.configuration.namespace
|
12
15
|
runtime.call(
|
13
16
|
"HamlCoffeeTemplate.template",
|
14
17
|
source,
|
15
|
-
|
16
|
-
HamlCoffeeTemplate.configuration.
|
17
|
-
HamlCoffeeTemplate.configuration.compiler_options
|
18
|
+
haml_coffee_compiler_options,
|
19
|
+
HamlCoffeeTemplate.configuration.coffee_script_compiler_options,
|
18
20
|
)
|
19
21
|
end
|
20
22
|
|
@@ -22,20 +24,21 @@ module HamlCoffeeTemplate
|
|
22
24
|
runtime.call(
|
23
25
|
"HamlCoffeeTemplate.compile",
|
24
26
|
source,
|
25
|
-
HamlCoffeeTemplate.configuration.
|
27
|
+
HamlCoffeeTemplate.configuration.haml_coffee_compiler_options,
|
28
|
+
HamlCoffeeTemplate.configuration.coffee_script_compiler_options
|
26
29
|
)
|
27
30
|
end
|
28
31
|
|
29
32
|
def runtime_source
|
30
|
-
[coffeescript_source,
|
33
|
+
[coffeescript_source, haml_coffee_source, wrapper_source].join(";")
|
31
34
|
end
|
32
35
|
|
33
36
|
def coffeescript_source
|
34
37
|
File.read(CoffeeScript::Source.path)
|
35
38
|
end
|
36
39
|
|
37
|
-
def
|
38
|
-
File.read(HamlCoffeeTemplate.configuration.
|
40
|
+
def haml_coffee_source
|
41
|
+
File.read(HamlCoffeeTemplate.configuration.haml_coffee_path)
|
39
42
|
end
|
40
43
|
|
41
44
|
def wrapper_source
|
@@ -1,11 +1,12 @@
|
|
1
1
|
module HamlCoffeeTemplate
|
2
2
|
class Configuration
|
3
|
-
attr_accessor :namespace, :
|
3
|
+
attr_accessor :namespace, :haml_coffee_compiler_options, :coffee_script_compiler_options, :haml_coffee_path
|
4
4
|
|
5
5
|
def initialize
|
6
6
|
self.namespace = "window.JST"
|
7
|
-
self.
|
8
|
-
self.
|
7
|
+
self.haml_coffee_compiler_options = {}
|
8
|
+
self.coffee_script_compiler_options = {}
|
9
|
+
self.haml_coffee_path = File.expand_path("haml-coffee.js", __dir__)
|
9
10
|
end
|
10
11
|
end
|
11
12
|
end
|
@@ -1,3 +1,10 @@
|
|
1
|
+
/**
|
2
|
+
* Haml Coffee v1.14.1
|
3
|
+
* https://github.com/netzpirat/haml-coffee
|
4
|
+
*
|
5
|
+
* Copyright (c) 2011 9elements, 2011-2013 Michael Kessler
|
6
|
+
* Released under the MIT License
|
7
|
+
*/
|
1
8
|
var require = function (file, cwd) {
|
2
9
|
var resolved = require.resolve(file, cwd || '/');
|
3
10
|
var mod = require.modules[resolved];
|
@@ -2,15 +2,15 @@ var HamlCoffeeTemplate = (function() {
|
|
2
2
|
var Compiler = require('./haml-coffee');
|
3
3
|
|
4
4
|
return {
|
5
|
-
template: function (src,
|
6
|
-
var compiler = new Compiler(
|
5
|
+
template: function (src, hamlCoffeeCompilerOptions, coffeeScriptCompilerOptions){
|
6
|
+
var compiler = new Compiler(hamlCoffeeCompilerOptions);
|
7
7
|
compiler.parse(src);
|
8
|
-
return CoffeeScript.compile(compiler.render(
|
8
|
+
return CoffeeScript.compile(compiler.render(), coffeeScriptCompilerOptions);
|
9
9
|
},
|
10
|
-
compile: function (src,
|
11
|
-
var compiler = new Compiler(
|
10
|
+
compile: function (src, hamlCoffeeCompilerOptions, coffeeScriptCompilerOptions){
|
11
|
+
var compiler = new Compiler(hamlCoffeeCompilerOptions);
|
12
12
|
compiler.parse(src);
|
13
|
-
return CoffeeScript.compile(compiler.precompile(),
|
13
|
+
return CoffeeScript.compile(compiler.precompile(), coffeeScriptCompilerOptions);
|
14
14
|
}
|
15
15
|
}
|
16
16
|
})();
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: haml_coffee_template
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Krists Ozols
|
@@ -48,7 +48,7 @@ files:
|
|
48
48
|
- lib/haml_coffee_template.rb
|
49
49
|
- lib/haml_coffee_template/compiler.rb
|
50
50
|
- lib/haml_coffee_template/configuration.rb
|
51
|
-
- lib/haml_coffee_template/
|
51
|
+
- lib/haml_coffee_template/haml-coffee.js
|
52
52
|
- lib/haml_coffee_template/processor.rb
|
53
53
|
- lib/haml_coffee_template/railtie.rb
|
54
54
|
- lib/haml_coffee_template/version.rb
|