guard-haml-coffee 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +29 -0
- data/Rakefile +2 -0
- data/guard-haml-coffee.gemspec +21 -0
- data/lib/guard-haml-coffee.rb +2 -0
- data/lib/guard/haml-coffee.rb +63 -0
- data/lib/guard/haml-coffee/hamlcoffee.js +1763 -0
- data/lib/guard/haml-coffee/hamlcoffee_compiler.js +80 -0
- data/lib/guard/haml-coffee/templates/Guardfile +3 -0
- data/lib/guard/haml-coffee/version.rb +7 -0
- metadata +91 -0
@@ -0,0 +1,80 @@
|
|
1
|
+
var HamlCoffeeCompiler = (function(){
|
2
|
+
|
3
|
+
var Compiler = require('./haml-coffee');
|
4
|
+
|
5
|
+
return {
|
6
|
+
|
7
|
+
/**
|
8
|
+
* Compile the HAML Coffee template to JavaScript
|
9
|
+
*
|
10
|
+
* @param name [String] the name of the template that is registered to the namespace
|
11
|
+
* @param source [String] the template source code to be compiled
|
12
|
+
* @param namespace [String] the template namespace
|
13
|
+
* @param jst [Boolean] if a JST template should be generated
|
14
|
+
* @param format [String] output HTML format
|
15
|
+
* @param uglify [Boolean] skip HTML indention
|
16
|
+
* @param basename [Boolean] ignore path when generate JST
|
17
|
+
* @param escapeHtml [Boolean] whether to escape HTML output by default or not
|
18
|
+
* @param escapeAttributes [Boolean] whether to escape HTML attributes output by default or not
|
19
|
+
* @param customHtmlEscape [String] the name of the function to escape the output
|
20
|
+
* @param customCleanValue [String] the name of the function to clean the code output
|
21
|
+
* @param customSurround [String] the name of the function for the surround helper
|
22
|
+
* @param customSucceed [String] the name of the function for the succeed helper
|
23
|
+
* @param customPrecede [String] the name of the function for the precede helper
|
24
|
+
* @param preserveTags [String] comma separated list of tags to preserve whitespace
|
25
|
+
* @param selfCloseTags [String] comma separated list of tags to self-closing tags
|
26
|
+
* @param context [String] the name of the function to merge contexts
|
27
|
+
* @param extendScope [Boolean] extend the scope with the context
|
28
|
+
*/
|
29
|
+
compile: function(name, source, jst, namespace, format, uglify, basename,
|
30
|
+
escapeHtml, escapeAttributes, cleanValue,
|
31
|
+
customHtmlEscape, customCleanValue, customPreserve, customFindAndPreserve,
|
32
|
+
customSurround, customSucceed, customPrecede,
|
33
|
+
preserveTags, selfCloseTags,
|
34
|
+
context, extendScope) {
|
35
|
+
|
36
|
+
var compiler = new Compiler({
|
37
|
+
format: format,
|
38
|
+
uglify: uglify,
|
39
|
+
basename: basename,
|
40
|
+
escapeHtml: escapeHtml,
|
41
|
+
escapeAttributes: escapeAttributes,
|
42
|
+
cleanValue: cleanValue,
|
43
|
+
customHtmlEscape: customHtmlEscape,
|
44
|
+
customCleanValue: customCleanValue,
|
45
|
+
customPreserve: customPreserve,
|
46
|
+
customFindAndPreserve: customFindAndPreserve,
|
47
|
+
customSurround: customSurround,
|
48
|
+
customSucceed: customSucceed,
|
49
|
+
customPrecede: customPrecede,
|
50
|
+
preserveTags: preserveTags,
|
51
|
+
selfCloseTags: selfCloseTags,
|
52
|
+
extendScope: extendScope
|
53
|
+
});
|
54
|
+
|
55
|
+
compiler.parse(source);
|
56
|
+
|
57
|
+
var template;
|
58
|
+
|
59
|
+
if (jst) {
|
60
|
+
template = CoffeeScript.compile(compiler.render(name, namespace));
|
61
|
+
|
62
|
+
} else {
|
63
|
+
var hamlc = CoffeeScript.compile(compiler.precompile(), { bare: true });
|
64
|
+
|
65
|
+
if (extendScope) {
|
66
|
+
template = '(function(context) {\n with(context || {}) {\n return (function() {\n' + hamlc.replace(/^(.*)$/mg, ' $1') + '\n };\n }).call(context);\n});';
|
67
|
+
} else {
|
68
|
+
template = '(function(context) {\n return (function() {\n' + hamlc.replace(/^(.*)$/mg, ' $1') + '\n }).call(context);\n});';
|
69
|
+
}
|
70
|
+
}
|
71
|
+
|
72
|
+
if (context !== '' && context !== false) {
|
73
|
+
template = template.replace('.call(context);', '.call(' + context + '(context));');
|
74
|
+
}
|
75
|
+
|
76
|
+
return template;
|
77
|
+
}
|
78
|
+
|
79
|
+
}
|
80
|
+
})();
|
metadata
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: guard-haml-coffee
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Ouvrages
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-08-22 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: guard
|
16
|
+
requirement: &86586000 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *86586000
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: execjs
|
27
|
+
requirement: &86585790 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *86585790
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: coffee-script
|
38
|
+
requirement: &86585580 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :runtime
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *86585580
|
47
|
+
description: Compiles a HamlCoffee .js.hamlc file to a .js javascript template
|
48
|
+
email:
|
49
|
+
- contact@ouvrages-web.fr
|
50
|
+
executables: []
|
51
|
+
extensions: []
|
52
|
+
extra_rdoc_files: []
|
53
|
+
files:
|
54
|
+
- .gitignore
|
55
|
+
- Gemfile
|
56
|
+
- LICENSE
|
57
|
+
- README.md
|
58
|
+
- Rakefile
|
59
|
+
- guard-haml-coffee.gemspec
|
60
|
+
- lib/guard-haml-coffee.rb
|
61
|
+
- lib/guard/haml-coffee.rb
|
62
|
+
- lib/guard/haml-coffee/hamlcoffee.js
|
63
|
+
- lib/guard/haml-coffee/hamlcoffee_compiler.js
|
64
|
+
- lib/guard/haml-coffee/templates/Guardfile
|
65
|
+
- lib/guard/haml-coffee/version.rb
|
66
|
+
homepage: https://github.com/ouvrages/guard-haml-coffee
|
67
|
+
licenses: []
|
68
|
+
post_install_message:
|
69
|
+
rdoc_options: []
|
70
|
+
require_paths:
|
71
|
+
- lib
|
72
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
|
+
none: false
|
80
|
+
requirements:
|
81
|
+
- - ! '>='
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
requirements: []
|
85
|
+
rubyforge_project:
|
86
|
+
rubygems_version: 1.8.11
|
87
|
+
signing_key:
|
88
|
+
specification_version: 3
|
89
|
+
summary: Guard gem for HamlCoffee
|
90
|
+
test_files: []
|
91
|
+
has_rdoc:
|