linner 0.5.0 → 0.5.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d8883d113979a23a06f305ffaa96e7c224e3e08d
4
- data.tar.gz: eae9dcb29be6f8b59a5696cc11d84504abc7145d
3
+ metadata.gz: 621f08f92c5f1e07d56b8bdef6826837958e39a1
4
+ data.tar.gz: 3fa21218b588ab55d3bc9cd1f144b87663b20a2a
5
5
  SHA512:
6
- metadata.gz: a9e63c8c9c462d9faa0aecc39885f5e74429ee366d773eccc09c02d99b408628031d3ef4c6dd5429b3f86e90333ebd6b88c88d04bd8ad10b6af4d6e4d1d47cf1
7
- data.tar.gz: 1d4fd2a6f5e681f9a0c7b361e5fde514a2efbfa32850b0f877c816aeb552db1baca5238a23afef2a429b63dadea92103640df9da0ac4b5747acf4b7fe9888b84
6
+ metadata.gz: 89898c38996e5c0fe23eec69eba7bb722232d1beef0200c95a93d89c9e2efa9ee59f180fcb7bd9403bd03b60dc139728468f40b32e25f3e26949432d54620c3c
7
+ data.tar.gz: 52183c4e3d0d9d16011490a59cc64863e1576532a1a71a7ecc9b07c7deec2909339257edebd9af0e79d8c42881d008eea0756e74d06f482c2dbeedc12660d8ec
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ v0.5.1
2
+ - support handlebars partials. templates start with "_" will be treaded as partials/
3
+
1
4
  v 0.5.0
2
5
  - linner command now provides `check` and `install` commands to check and install vendor dependencies
3
6
 
data/lib/linner/asset.rb CHANGED
@@ -51,8 +51,12 @@ module Linner
51
51
  def wrap(source)
52
52
  if javascript?
53
53
  Wrapper::Module.wrap(logical_path.chomp(File.extname logical_path), source)
54
- else
55
- Wrapper::Template.wrap(logical_path.chomp(File.extname logical_path), source)
54
+ elsif template?
55
+ if File.basename(path).start_with?("_")
56
+ Wrapper::Template.partial_wrap(logical_path.chomp(File.extname logical_path), source)
57
+ else
58
+ Wrapper::Template.wrap(logical_path.chomp(File.extname logical_path), source)
59
+ end
56
60
  end
57
61
  end
58
62
 
@@ -1,3 +1,3 @@
1
1
  module Linner
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
@@ -2,9 +2,9 @@ module Linner
2
2
  module Wrapper
3
3
  class Module
4
4
  def self.wrap(name, content)
5
- <<-WRAPPER
5
+ <<-WRAPPER
6
6
  this.require.define({"#{name}":function(exports, require, module){#{content};}});
7
- WRAPPER
7
+ WRAPPER
8
8
  end
9
9
 
10
10
  def self.definition
@@ -14,18 +14,25 @@ this.require.define({"#{name}":function(exports, require, module){#{content};}})
14
14
 
15
15
  class Template
16
16
  def self.wrap(name, content)
17
- <<-WRAPPER
17
+ <<-WRAPPER
18
18
  templates["#{name}"] = template(#{content});
19
- WRAPPER
19
+ WRAPPER
20
20
  end
21
21
 
22
+ def self.partial_wrap(name, content)
23
+ <<-PARTIAL
24
+ Handlebars.registerPartial("#{name}", Handlebars.template(#{content}));
25
+ PARTIAL
26
+ end
27
+
28
+
22
29
  def self.definition(content)
23
- <<-DEFINITION
30
+ <<-DEFINITION
24
31
  (function() {
25
32
  var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
26
33
  #{content}
27
34
  })();
28
- DEFINITION
35
+ DEFINITION
29
36
  end
30
37
  end
31
38
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: linner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Saito
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-08 00:00:00.000000000 Z
11
+ date: 2013-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: reel