stylio 0.0.2 → 0.0.3
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 +4 -4
- data/README.md +16 -5
- data/lib/stylio/app.rb +28 -6
- data/lib/stylio/version.rb +1 -1
- data/lib/stylio/views/examples.erb +8 -0
- data/lib/stylio/views/menu.erb +1 -0
- metadata +4 -4
- data/lib/stylio/views/layout.erb +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f1fe5111c2ec9d099fef060d0f07d82e701b37e
|
4
|
+
data.tar.gz: 026d50440dbb3cb81055cfd1894752410228d338
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 226361459e961b082b88976588145510b3fd4a3ecb9b3ec4ecc023de43fa360356b68e5c0427ca81f1d809aac4a99a5d3ad600ac62e2217809fc2fab079be053
|
7
|
+
data.tar.gz: 1920810b7efda0c2854e58cb102a486d970c14cf785043ab637327d05c306c9a8e44f7623f9443663c33c4dc91b58ce15e47ab158bb6582a6b6efbf3ad552ffb
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Stylio
|
2
2
|
|
3
|
-
Stylio is a Sinatra based
|
3
|
+
Stylio is a Sinatra based framework to make a living style guide that can easily be ported into a Rails application.
|
4
4
|
|
5
5
|
Currently supports Sass and ERB
|
6
6
|
|
@@ -20,7 +20,7 @@ Or install it yourself as:
|
|
20
20
|
|
21
21
|
`gem install stylio`
|
22
22
|
|
23
|
-
Add framework folders
|
23
|
+
Add the framework folders
|
24
24
|
|
25
25
|
`mkdir components && mkdir layouts`
|
26
26
|
|
@@ -34,7 +34,7 @@ Stylesheets are added to the `assets/stylesheets` folder which you will need to
|
|
34
34
|
|
35
35
|
## Adding components
|
36
36
|
|
37
|
-
`mkdir COMPONENT_NAME` and then add two files in this folder:
|
37
|
+
`mkdir components/COMPONENT_NAME` and then add two files in this folder:
|
38
38
|
|
39
39
|
An erb partial `touch _COMPONENT_NAME.html.erb`
|
40
40
|
A fixture file `touch COMPONENT_NAME.yml`
|
@@ -45,11 +45,22 @@ See (stylio-example)[http://github.com/substrakt/stylio-example] to see an examp
|
|
45
45
|
|
46
46
|
## Adding layouts
|
47
47
|
|
48
|
-
`mkdir LAYOUT_NAME` and then add a file in this folder:
|
48
|
+
`mkdir layouts/LAYOUT_NAME` and then add a file in this folder:
|
49
49
|
|
50
50
|
An erb template `touch LAYOUT_NAME.html.erb`
|
51
51
|
|
52
|
-
No parameters can be referenced on this page except for `<%=
|
52
|
+
No parameters can be referenced on this page except for `<%= yield %>`.
|
53
|
+
|
54
|
+
See (stylio-example)[http://github.com/substrakt/stylio-example] to see an example setup.
|
55
|
+
|
56
|
+
## Adding examples
|
57
|
+
|
58
|
+
`mkdir examples/EXAMPLE_NAME` and then add a file in this folder:
|
59
|
+
|
60
|
+
An erb template `touch EXAMPLE_NAME.html.erb`
|
61
|
+
and yaml file `touch EXAMPLE_NAME.yml`
|
62
|
+
|
63
|
+
No parameters can be referenced on this page except for `<%= yield %>` and calling other components and the name of the yml data `<%= render_component 'component_name', :component_data %>`
|
53
64
|
|
54
65
|
See (stylio-example)[http://github.com/substrakt/stylio-example] to see an example setup.
|
55
66
|
|
data/lib/stylio/app.rb
CHANGED
@@ -54,22 +54,44 @@ module Stylio
|
|
54
54
|
end
|
55
55
|
|
56
56
|
get '/layouts/:id' do
|
57
|
-
|
58
57
|
name = params[:id]
|
59
58
|
path = File.join(settings.app_path, 'layouts', name)
|
60
59
|
|
61
|
-
erb :layout
|
60
|
+
erb :styleguide, :layout => false do
|
61
|
+
erb :"#{path}/#{name}.html" do
|
62
|
+
"Yielded content"
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
get '/examples' do
|
68
|
+
examples = File.join(settings.app_path, 'examples')
|
69
|
+
directories = Dir.entries(examples).select {|f| !File.directory? f}
|
70
|
+
erb :examples,
|
62
71
|
locals: {
|
63
|
-
|
64
|
-
path: path
|
72
|
+
examples: directories
|
65
73
|
}, layout: :styleguide
|
66
74
|
end
|
67
75
|
|
76
|
+
get '/examples/:id' do
|
77
|
+
|
78
|
+
name = params[:id]
|
79
|
+
layouts = File.join(settings.app_path, 'layouts')
|
80
|
+
path = File.join(settings.app_path, 'examples', name)
|
81
|
+
yaml = YAML.load_file(File.join(path, "#{ name }.yml"))
|
82
|
+
|
83
|
+
erb :styleguide, :layout => false do
|
84
|
+
erb :"#{layouts}/#{yaml['layout']}/#{yaml['layout']}.html", :layout => false do
|
85
|
+
erb :"#{path}/#{name}.html"
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
68
90
|
helpers do
|
69
91
|
def render_component(name, key)
|
70
|
-
path = File.join(settings.components, name)
|
92
|
+
path = File.join(settings.app_path, 'components', name)
|
71
93
|
yaml = YAML.load_file(File.join(path, "#{ name }.yml"))
|
72
|
-
erb :"
|
94
|
+
erb :"#{path}/_#{name}.html", locals: { params: yaml[key.to_s] }
|
73
95
|
end
|
74
96
|
end
|
75
97
|
end
|
data/lib/stylio/version.rb
CHANGED
data/lib/stylio/views/menu.erb
CHANGED
@@ -4,5 +4,6 @@
|
|
4
4
|
<li style="display: inline;"><a style="color: #FFF;" href="/elements">Elements</a></li>
|
5
5
|
<li style="display: inline;"><a style="color: #FFF;" href="/components">Components</a></li>
|
6
6
|
<li style="display: inline;"><a style="color: #FFF;" href="/layouts">Layouts</a></li>
|
7
|
+
<li style="display: inline;"><a style="color: #FFF;" href="/examples">Examples</a></li>
|
7
8
|
</ul>
|
8
9
|
</div>
|
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.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Substrakt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-07-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sinatra
|
@@ -119,8 +119,8 @@ files:
|
|
119
119
|
- lib/stylio/views/component.erb
|
120
120
|
- lib/stylio/views/components.erb
|
121
121
|
- lib/stylio/views/elements.erb
|
122
|
+
- lib/stylio/views/examples.erb
|
122
123
|
- lib/stylio/views/header.erb
|
123
|
-
- lib/stylio/views/layout.erb
|
124
124
|
- lib/stylio/views/layouts.erb
|
125
125
|
- lib/stylio/views/menu.erb
|
126
126
|
- lib/stylio/views/styleguide.erb
|
@@ -147,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
147
147
|
version: '0'
|
148
148
|
requirements: []
|
149
149
|
rubyforge_project:
|
150
|
-
rubygems_version: 2.
|
150
|
+
rubygems_version: 2.5.1
|
151
151
|
signing_key:
|
152
152
|
specification_version: 4
|
153
153
|
summary: An independent living styleguide with simple Rails portability
|
data/lib/stylio/views/layout.erb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
<%= erb :"#{path}/#{name}.html", locals: { yield_placeholder: 'Yielded content' } %>
|