stylio 0.2.1 → 0.3.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: 682185884aa7f649c1b8d77213ca884b776898d6
4
- data.tar.gz: 3e74eb9bf662b2918605cee3d3165570557e300e
3
+ metadata.gz: 60218fda6b42e1680797d45c2d668996d6cc82d6
4
+ data.tar.gz: 7016bdd97d371571964df44c6a0eb0aa59051f77
5
5
  SHA512:
6
- metadata.gz: 8ac70893f1ed7f54c9b0811ec6c94922ce71ba57ded526c57f9ecc8ee02b2a85a5912f6595234efc1cd1c429945c112f731b6a476fccefe5bc85968a7382c47d
7
- data.tar.gz: 96e604fd1baa09dd8eb0286fe30f63206eb82d1999ba081796d1f3872115ed62dbbe65df14ff2ade87210331abcd16653b14d2a1a16a1163944c8ac7c44ecd0e
6
+ metadata.gz: 4990cd38e34ec897fae672d230e5708eba41e0be71b236e6b65359c4350df6c8dfbdc5a9612e1ef832f518fb02d0d83cd854b6db8457379a66c9c2e03ae8f1d4
7
+ data.tar.gz: 38fccff91a4390906926d98d729bae5a9160e7b030a195dacdac83d057acc249146a0282e9ad9171525c54e85522bfe26c82f45f663e571255e33216902fe549
data/lib/stylio/app.rb CHANGED
@@ -59,7 +59,7 @@ module Stylio
59
59
  locals: {
60
60
  name: name,
61
61
  path: path,
62
- fixtures: YAML.load_file(File.join(path, "#{ name }.yml"))
62
+ fixtures: choose_fixture(path, name)
63
63
  }, layout: :styleguide
64
64
  end
65
65
 
@@ -106,11 +106,25 @@ module Stylio
106
106
  end
107
107
  end
108
108
 
109
+ def choose_fixture(path, name)
110
+ if File.exists?(File.join("#{path}/#{ name }.yml.erb"))
111
+ YAML.load(erb(:"#{path}/#{ name }.yml"))
112
+ else
113
+ YAML.load_file(File.join(path, "#{name}.yml"))
114
+ end
115
+ end
116
+
109
117
  helpers do
110
118
  def render_component(name, key)
111
119
  path = File.join(settings.app_path, 'components', name)
112
120
  yaml = YAML.load_file(File.join(path, "#{ name }.yml"))
113
- erb :"#{path}/_#{name}.html", locals: { params: yaml[key.to_s] }
121
+ erb(:"#{path}/_#{name}.html", locals: { params: yaml[key.to_s] })
122
+ end
123
+
124
+ def sub_component(name, key)
125
+ path = File.join(settings.app_path, 'components', name)
126
+ yaml = YAML.load_file(File.join(path, "#{ name }.yml"))
127
+ erb(:"#{path}/_#{name}.html", locals: { params: yaml[key.to_s] }).dump[1...-1].gsub('\n', '')
114
128
  end
115
129
 
116
130
  def render_yield(key)
@@ -1,3 +1,3 @@
1
1
  module Stylio
2
- VERSION = "0.2.1"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stylio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Substrakt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-06 00:00:00.000000000 Z
11
+ date: 2017-07-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra