sprockets-vue 0.0.6 → 0.1.0

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: 916a3905fa210c379fde7c43f7bc50803908cfbc
4
- data.tar.gz: dbe32c6100503aa04f2a3740e885087f658d93ad
3
+ metadata.gz: c7311867a8bcda251efd83d54626666d9c0e1d49
4
+ data.tar.gz: dc0da974427557191ef8c5281283ad89f7ad6711
5
5
  SHA512:
6
- metadata.gz: c028716c2743b9d70016299ef7f0e8747f62d58039f5d804f469e074aec069de7734d88c12b1c4b0d90ffd891694ec463c8fc36c6a333f8d8aba076b9617aa72
7
- data.tar.gz: 3015fb7739083a05a1b12ebefcffba63b766fd80e4a09848de51c839bdaea293fee6327fc98522e83a7780dad06f431f2595b2a33b5e73a69ba8c82f7cd26948
6
+ metadata.gz: 316e086dcef3c8407d37b615030cb63e3dfe8a9d1dca57ce2381dd698a5358e2905209a4ad4ac6a71a3009c945a1a553cefb514361f48a9f69697a9133cf60f8
7
+ data.tar.gz: 4bc1f43e4d6e13fdb6ee93447481f5f3e01eb700a444a2750d7bb4af22a75ff0fa374c23310833eba515ab7cdf12e635841ac7c0e05bd670c869cd1a5dee8be0
data/README.md CHANGED
@@ -5,32 +5,39 @@
5
5
 
6
6
  A [Sprockets](https://github.com/rails/sprockets) transformer that converts .vue file into js object.
7
7
 
8
+
9
+ # heads up!
10
+
11
+ version 0.1.0 has incompatible changes, attempting to make the syntax
12
+ work more similarly to Webpack/vue-loader.
13
+
14
+ Specifically:
15
+
16
+ - You should assign `module.exports` variable to make it work! (not vm)
17
+ - You should use `VComponents` instead of `VCompents`
18
+ - Now supports normal javascript (as well as coffeescript)
19
+
8
20
  # feature
9
21
 
10
22
  following tag is supported in .vue file
11
- * script (currently coffeescript only)
23
+ * script (coffeescript and js)
12
24
  * template (currently html only)
13
25
  * style (scss, sass and css)
14
26
 
15
27
  # install
16
28
  add `gem 'sprockets-vue'` to Gemfile, and run bundle, currently works with sprockets 3.
17
29
 
18
- # heads up!
19
- version 0.0.6 has incompatible change, due to bugs in previous version.
20
-
21
- now you should assign `vm` variable to make it works!
22
-
23
30
  # example
24
31
  * index.vue
25
32
  ```vue
26
- //= require compents/card
33
+ //= require components/card
27
34
  <script lang="coffee">
28
- vm = {
35
+ module.exports = {
29
36
  data: ->
30
37
  search: ''
31
38
  members: []
32
39
  components:
33
- card: VCompents['compents/card']
40
+ card: VComponents['components/card']
34
41
  methods:
35
42
  clear: ->
36
43
  this.search = ''
@@ -65,7 +72,7 @@ vm = {
65
72
  new Vue(
66
73
  el: '#search',
67
74
  components: {
68
- 'index': VCompents.index
75
+ 'index': VComponents.index
69
76
  }
70
77
  )
71
78
  ```
@@ -13,7 +13,8 @@ module Sprockets::Vue
13
13
  },
14
14
  'es6' => ->(s, input){
15
15
  Babel::Transpiler.transform(data, {}) #TODO
16
- }
16
+ },
17
+ nil => ->(s,input){ { 'js' => s } }
17
18
  }
18
19
  def call(input)
19
20
  data = input[:data]
@@ -25,14 +26,16 @@ module Sprockets::Vue
25
26
  map = nil
26
27
  if script
27
28
  result = SCRIPT_COMPILES[script[:lang]].call(script[:content], input)
29
+
28
30
  map = result['sourceMap']
29
31
 
30
- output << "'object' != typeof VCompents && (VCompents = {});
31
- #{result['js']}; VCompents['#{name}'] = vm;"
32
+ output << "'object' != typeof VComponents && (this.VComponents = {});
33
+ var module = { exports: null };
34
+ #{result['js']}; VComponents['#{name}'] = module.exports;"
32
35
  end
33
36
 
34
37
  if template
35
- output << "VCompents['#{name.sub(/\.tpl$/, "")}'].template = '#{j template[:content]}';"
38
+ output << "VComponents['#{name.sub(/\.tpl$/, "")}'].template = '#{j template[:content]}';"
36
39
  end
37
40
 
38
41
  { data: "#{warp(output.join)}", map: map }
@@ -1,5 +1,5 @@
1
1
  module Sprockets
2
2
  module Vue
3
- VERSION = '0.0.6'
3
+ VERSION = '0.1.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sprockets-vue
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - kikyous
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-22 00:00:00.000000000 Z
11
+ date: 2017-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sprockets