style_train 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,161 @@
1
+ class FooSheet < StyleTrain::StyleSheet do
2
+ def content
3
+ add(:my_div) do
4
+ border :color => :gray
5
+ add(:p) do
6
+ font :size => 1.5.em
7
+ end
8
+ }
9
+ end
10
+ end
11
+
12
+ class FooSheet < StyleTrain::StyleSheet do
13
+ def content
14
+ << :my_div {
15
+ border :color => :gray
16
+ << :p {
17
+ font :size => 1.5.em
18
+ }
19
+ }
20
+ end
21
+ end
22
+
23
+ # builds foo_sheet.css
24
+ <<-CSS
25
+ .my_div {
26
+ border: 1px solid gray;
27
+ }
28
+
29
+ .my_div p {
30
+ font-size: 1.5em;
31
+ }
32
+ CSS
33
+
34
+ # ---------------------
35
+
36
+ <<-CSS
37
+ body { font-size: 13px; line-height: 1.5; #{theme[:sans]}; }
38
+
39
+ h1 {font-size: 25px;}
40
+ h2 {font-size: 23px;}
41
+ h3 {font-size: 18px;}
42
+ h3 { margin: 0; }
43
+ h4 {font-size: 16px;}
44
+ h5 {font-size: 11px;}
45
+ h6 {font-size: 10px;}
46
+
47
+ hr {
48
+ border: none;
49
+ height: 1px;
50
+ color: #{Theme::COHUMAN[:light_grey]};
51
+ background-color: #{Theme::COHUMAN[:light_grey]};
52
+ }
53
+
54
+ .create_button{
55
+ font-weight: bold;
56
+ font-size:.8em;
57
+ cursor: pointer;
58
+ padding: 0 0.5em;
59
+ color: #{theme[:button_text]};
60
+ border: 1px solid #{theme[:button_border]};
61
+ }
62
+
63
+ .activity_button {
64
+ display:inline-block;
65
+ overflow:visible;
66
+ padding:0;
67
+ position:relative;
68
+ font-weight: bold;
69
+ font-size:.8em;
70
+ cursor: pointer;
71
+ color: #{theme[:button_text]};
72
+ border: 1px solid #{theme[:activity_button_border]};
73
+ }
74
+
75
+ .user_info {
76
+ padding: 10px 10px 0px 10px;
77
+ width: #{Panel::WIDTH - 20}px;
78
+ overflow-x: hidden;
79
+ }
80
+
81
+ .user_info h1 {
82
+ margin: -4px 0 -2px 0;
83
+ font-size:1.5em;
84
+ }
85
+
86
+ .user_info h1 < div {
87
+ padding: 2em;
88
+ }
89
+
90
+ .user_info h1 < p {
91
+ padding: 1em;
92
+ }
93
+
94
+ CSS
95
+
96
+ class Cohuman < StyleTrain::Sheet
97
+ def content
98
+ body {
99
+ font :size => 13.px, :family => theme[:sans]
100
+ line_height 1.5
101
+ }
102
+
103
+ h1 { font :size => 25.px}
104
+ h2 { font :size => 23.px}
105
+ h3 { font :size => 18.px}
106
+ h3 { margin :none }
107
+ h4 { font :size => 16.px}
108
+ h5 { font :size => 11.px}
109
+ h6 { font :size => 10.px}
110
+
111
+ hr {
112
+ border :none
113
+ height 1.px
114
+ color theme[:neutral][1]
115
+ background :color => theme[:light_gray]
116
+ }
117
+
118
+ selector(:create_button) {
119
+ font :weight => :bold, :size => 8.em
120
+ border :color => theme[:button_border]
121
+ color theme[:button_text]
122
+ cursor :pointer
123
+ padding [0 0.5.em]
124
+ }
125
+
126
+ selector(:activity_button) {
127
+ display :inline_block
128
+ position :relative
129
+ overflow :visible
130
+ padding :none
131
+ font :weight => :bold, :size => 0.8.em
132
+ cursor :pointer
133
+ color theme[:button_text]}
134
+ border :color => theme[:activity_button_border]
135
+ }
136
+
137
+ +(:user_info) {
138
+ padding 10.px, 10.px 0.px 10.px
139
+ width (Panel::WIDTH - 20).px;
140
+ overflow :x => :hidden
141
+
142
+ h1 {
143
+ margin -4.px, 0, -2px, 0
144
+ font :size => 1.5.em
145
+ }
146
+
147
+ <(:my_class){
148
+ padding 2.em
149
+ }
150
+
151
+ <(p){
152
+ padding 1.em
153
+ }
154
+ }
155
+ end
156
+ end
157
+
158
+ # Floats and Fixnums should respond to .em .px, etc
159
+ # methods for each of the html tags
160
+ # Sheet class has methods for all css attributes
161
+ # Sheet class should take an optional theme, have theme attribute
metadata ADDED
@@ -0,0 +1,102 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: style_train
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Kane Baccigalupi
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-02-17 00:00:00 -08:00
19
+ default_executable:
20
+ dependencies: []
21
+
22
+ description: style_train builds CSS using pure Ruby, not a DSL interpreted via Ruby. This allows inheritance, modules, instance level calculations and all the goodness Ruby can offer.
23
+ email: baccigalupi@gmail.com
24
+ executables: []
25
+
26
+ extensions: []
27
+
28
+ extra_rdoc_files:
29
+ - README.rdoc
30
+ files:
31
+ - LISENCE
32
+ - README.rdoc
33
+ - Rakefile
34
+ - VERSION
35
+ - lib/style_train.rb
36
+ - lib/style_train/color.rb
37
+ - lib/style_train/color_types/color_type.rb
38
+ - lib/style_train/color_types/hex_color.rb
39
+ - lib/style_train/color_types/hsl_color.rb
40
+ - lib/style_train/color_types/keyword_color.rb
41
+ - lib/style_train/color_types/rgb_color.rb
42
+ - lib/style_train/sheet.rb
43
+ - lib/style_train/support/gnash.rb
44
+ - lib/style_train/support/numbers.rb
45
+ - lib/style_train/support/string.rb
46
+ - spec/color/color_spec.rb
47
+ - spec/color/color_type_spec.rb
48
+ - spec/color/hex_color_spec.rb
49
+ - spec/color/keyword_color_spec.rb
50
+ - spec/color/rgb_color_spec.rb
51
+ - spec/numbers_spec.rb
52
+ - spec/sheet_spec.rb
53
+ - spec/spec.opts
54
+ - spec/spec_helper.rb
55
+ - style_train.gemspec
56
+ - utils/alexch_color_gist/color.rb
57
+ - utils/alexch_color_gist/color_test.rb
58
+ - utils/overview.txt
59
+ - utils/stylesheet.txt
60
+ has_rdoc: true
61
+ homepage: http://github.com/baccigalupi/style_train
62
+ licenses: []
63
+
64
+ post_install_message:
65
+ rdoc_options: []
66
+
67
+ require_paths:
68
+ - lib
69
+ required_ruby_version: !ruby/object:Gem::Requirement
70
+ none: false
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ hash: 3
75
+ segments:
76
+ - 0
77
+ version: "0"
78
+ required_rubygems_version: !ruby/object:Gem::Requirement
79
+ none: false
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ hash: 3
84
+ segments:
85
+ - 0
86
+ version: "0"
87
+ requirements: []
88
+
89
+ rubyforge_project:
90
+ rubygems_version: 1.3.7
91
+ signing_key:
92
+ specification_version: 3
93
+ summary: style_train builds CSS with Ruby
94
+ test_files:
95
+ - spec/color/color_spec.rb
96
+ - spec/color/color_type_spec.rb
97
+ - spec/color/hex_color_spec.rb
98
+ - spec/color/keyword_color_spec.rb
99
+ - spec/color/rgb_color_spec.rb
100
+ - spec/numbers_spec.rb
101
+ - spec/sheet_spec.rb
102
+ - spec/spec_helper.rb