gumdrop 0.4.0 → 0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. data/.gitignore +2 -2
  2. data/ChangeLog.md +17 -0
  3. data/Notes.md +8 -1
  4. data/lib/gumdrop.rb +82 -45
  5. data/lib/gumdrop/build.rb +10 -0
  6. data/lib/gumdrop/cli.rb +119 -33
  7. data/lib/gumdrop/context.rb +6 -1
  8. data/lib/gumdrop/deferred_loader.rb +54 -15
  9. data/lib/gumdrop/dsl.rb +8 -2
  10. data/lib/gumdrop/generator.rb +41 -2
  11. data/lib/gumdrop/version.rb +1 -1
  12. data/{lib/gumdrop/template/default → templates/backbone}/Gemfile +6 -4
  13. data/templates/backbone/Gumdrop +119 -0
  14. data/{lib/gumdrop/template → templates}/backbone/Rakefile +0 -0
  15. data/{lib/gumdrop/template → templates}/backbone/app/app.js.coffee +0 -0
  16. data/{lib/gumdrop/template → templates}/backbone/app/init.js.coffee +0 -0
  17. data/{lib/gumdrop/template → templates}/backbone/app/models/.gitkeep +0 -0
  18. data/{lib/gumdrop/template → templates}/backbone/app/utils/index.js.coffee +0 -0
  19. data/{lib/gumdrop/template → templates}/backbone/app/views/home.js.coffee +0 -0
  20. data/{lib/gumdrop/template → templates}/backbone/app/views/styles/home.scss +0 -0
  21. data/{lib/gumdrop/template → templates}/backbone/app/views/templates/home.mustache +0 -0
  22. data/{lib/gumdrop/template → templates}/backbone/config.ru +0 -0
  23. data/{lib/gumdrop/template/backbone/lib/javascript → templates/backbone/lib}/all.js.coffee +0 -0
  24. data/{lib/gumdrop/template/backbone/lib/javascript → templates/backbone/lib}/backbone.js +0 -0
  25. data/{lib/gumdrop/template/backbone/lib/javascript → templates/backbone/lib}/hogan.js +0 -0
  26. data/{lib/gumdrop/template/backbone/lib/javascript → templates/backbone/lib}/jquery.js +0 -0
  27. data/{lib/gumdrop/template/backbone/lib/javascript → templates/backbone/lib}/underscore.js +0 -0
  28. data/{lib/gumdrop/template → templates}/backbone/powrc +0 -0
  29. data/{lib/gumdrop/template/backbone/source/default.htaccess → templates/backbone/source/default.htaccess.erb} +4 -0
  30. data/{examples/simple → templates/backbone}/source/favicon.ico +0 -0
  31. data/{lib/gumdrop/template → templates}/backbone/source/feed.xml.builder.txt +8 -8
  32. data/{lib/gumdrop/template → templates}/backbone/source/index.html.erb +0 -0
  33. data/{lib/gumdrop/template → templates}/backbone/source/theme/screen.css.sass +0 -0
  34. data/{lib/gumdrop/template → templates}/backbone/source/theme/scripts/app.js.coffee +0 -0
  35. data/{examples/simple → templates/backbone}/source/theme/styles/_tools.scss +0 -0
  36. data/{lib/gumdrop/template → templates}/backbone/source/theme/templates/app.template.slim +1 -1
  37. data/{lib/gumdrop/template → templates}/backbone/source/theme/templates/site.template.slim +3 -3
  38. data/{lib/gumdrop/template/backbone → templates/default}/Gemfile +6 -4
  39. data/templates/default/Gumdrop +109 -0
  40. data/{lib/gumdrop/template → templates}/default/Rakefile +0 -0
  41. data/{lib/gumdrop/template → templates}/default/config.ru +0 -0
  42. data/{lib/gumdrop/template → templates}/default/powrc +0 -0
  43. data/{lib/gumdrop/template/default/source/default.htaccess → templates/default/source/default.htaccess.erb} +11 -1
  44. data/{lib/gumdrop/template/backbone → templates/default}/source/favicon.ico +0 -0
  45. data/{lib/gumdrop/template → templates}/default/source/feed.xml.builder.txt +8 -8
  46. data/templates/default/source/index.html.erb +1 -0
  47. data/{lib/gumdrop/template → templates}/default/source/theme/screen.css.sass +0 -0
  48. data/{lib/gumdrop/template → templates}/default/source/theme/scripts/app.js.coffee +0 -0
  49. data/{lib/gumdrop/template/backbone → templates/default}/source/theme/styles/_tools.scss +0 -0
  50. data/{lib/gumdrop/template → templates}/default/source/theme/templates/site.template.slim +3 -3
  51. metadata +56 -83
  52. data/examples/simple/Gemfile +0 -22
  53. data/examples/simple/Rakefile +0 -42
  54. data/examples/simple/config.ru +0 -15
  55. data/examples/simple/data/config.yml +0 -10
  56. data/examples/simple/data/posts.yamldb +0 -28
  57. data/examples/simple/lib/site.rb +0 -24
  58. data/examples/simple/lib/view_helpers.rb +0 -17
  59. data/examples/simple/source/.htaccess +0 -16
  60. data/examples/simple/source/_pager_control.html.erb +0 -14
  61. data/examples/simple/source/_sidebar.html.haml +0 -2
  62. data/examples/simple/source/feed.xml.builder +0 -23
  63. data/examples/simple/source/index.html.erb +0 -4
  64. data/examples/simple/source/posts.generator.rb +0 -11
  65. data/examples/simple/source/posts/index.html.erb +0 -6
  66. data/examples/simple/source/theme/screen.css.scss +0 -10
  67. data/examples/simple/source/theme/scripts/app.js.coffee +0 -0
  68. data/examples/simple/source/theme/templates/post.template.haml +0 -3
  69. data/examples/simple/source/theme/templates/post_page.template.haml +0 -6
  70. data/examples/simple/source/theme/templates/site.template.haml +0 -33
  71. data/examples/simple/source/theme/templates/test.template.erb +0 -1
  72. data/lib/gumdrop/template/backbone/data/config.yml +0 -4
  73. data/lib/gumdrop/template/backbone/lib/site.rb +0 -62
  74. data/lib/gumdrop/template/backbone/lib/stitch_compilers.rb +0 -1
  75. data/lib/gumdrop/template/backbone/lib/view_helpers.rb +0 -17
  76. data/lib/gumdrop/template/default/data/config.yml +0 -4
  77. data/lib/gumdrop/template/default/lib/site.rb +0 -50
  78. data/lib/gumdrop/template/default/lib/view_helpers.rb +0 -17
  79. data/lib/gumdrop/template/default/source/favicon.ico +0 -0
  80. data/lib/gumdrop/template/default/source/index.html.erb +0 -1
  81. data/lib/gumdrop/template/default/source/theme/styles/_tools.scss +0 -434
@@ -1,24 +0,0 @@
1
- # Any specialized code for your site goes here...
2
-
3
- puts "Building: #{Gumdrop.data.config.title}"
4
-
5
- new_posts= Gumdrop.data.posts.map do |post|
6
- mdt= Tilt['markdown'].new { post.content }
7
- post.body = mdt.render
8
- post
9
- end
10
-
11
- Gumdrop.data.set :blog, new_posts, :persist=>true
12
-
13
-
14
- generate do
15
-
16
- page "my-root-page.html", :template=>'test', :info=>"FROM SITE.RB"
17
-
18
- pager= Gumdrop.data.pager_for :blog, :base_path=>'posts/page', :page_size=>1
19
-
20
- pager.each do |pageset|
21
- page "#{pageset.uri}.html", :template=>'post_page', :posts=>pageset.items, :pager=>pager, :current_page=>pager.current_page
22
- end
23
-
24
- end
@@ -1,17 +0,0 @@
1
- module Gumdrop::ViewHelpers
2
-
3
- # Calculate the years for a copyright
4
- def copyright_years(start_year, divider="–")
5
- end_year = Date.today.year
6
- if start_year == end_year
7
- "#{start_year}"
8
- else
9
- "#{start_year}#{divider}#{end_year}"
10
- end
11
- end
12
-
13
- #
14
- # Your custom helpers go here!
15
- #
16
-
17
- end
@@ -1,16 +0,0 @@
1
- # For clean urls
2
- DirectoryIndex index.html
3
-
4
- <IfModule mod_rewrite.c>
5
- RewriteEngine On
6
- RewriteBase /
7
-
8
- # Do not do anything for already existing files and folders
9
- RewriteCond %{REQUEST_FILENAME} -f [OR]
10
- RewriteCond %{REQUEST_FILENAME} -d
11
- RewriteRule .+ - [L]
12
-
13
- # add .html file extension (if such file does exist)
14
- RewriteCond %{DOCUMENT_ROOT}/$1\.html -f
15
- RewriteRule ^(.+[^/])/?$ $1.html [L,QSA]
16
- </IfModule>
@@ -1,14 +0,0 @@
1
- <%
2
- previous_page = [(current_page - 1), 1].max
3
- next_page = [(current_page + 1), pager.length].min
4
- %>
5
- <div class="page">
6
- <a href="<%= uri pager[previous_page - 1].uri %>">&larr;</a>
7
- <%
8
- pager.each do |pager_page|
9
- class_name= pager_page.page == current_page ? 'current' : ''
10
- %>
11
- <a href="<%= uri pager_page.uri %>" class="<%= class_name %>"><%= pager_page.page %></a>
12
- <% end %>
13
- <a href="<%= uri pager[next_page - 1].uri %>">&rarr;</a>
14
- </div>
@@ -1,2 +0,0 @@
1
- :markdown
2
- I'm the sidebar.
@@ -1,23 +0,0 @@
1
- xml.instruct!
2
- xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do
3
- xml.title data.config.title
4
- xml.subtitle data.config.tagline
5
- xml.id data.config.url
6
- xml.link "href" => data.config.url
7
- xml.link "href" => "#{data.config.url}/feed.xml", "rel" => "self"
8
- xml.updated data.blog.first.date.to_time.iso8601
9
- xml.author { xml.name data.config.author }
10
-
11
- data.blog.each do |post|
12
- xml.entry do
13
- url= "#{data.config.url}/posts/#{post.slug}"
14
- xml.title post.title
15
- xml.link "rel" => "alternate", "href" => url
16
- xml.id url
17
- xml.published post.date.to_time.iso8601
18
- xml.updated post.date.to_time.iso8601
19
- xml.author { xml.name data.config.author }
20
- xml.content post.body, "type" => "html"
21
- end
22
- end
23
- end
@@ -1,4 +0,0 @@
1
- <p>Welcome to <%= data.config.title %></p>
2
-
3
-
4
- <p>POSTS: <%= data.blog.length %></p>
@@ -1,11 +0,0 @@
1
-
2
- set :template, "post"
3
-
4
- data.blog.each do |post|
5
- # mdt= Tilt['markdown'].new { post.content }
6
- # post.body = mdt.render
7
-
8
- page "#{post.slug}.html", :template=>'post', :post=>post
9
- end
10
-
11
- #page "index.html"
@@ -1,6 +0,0 @@
1
- <h2>Post Archive</h2>
2
- <ul>
3
- <% data.blog.each do |post| %>
4
- <li><a href="<%= uri "/posts/#{post.slug}" %>"><%= post.title %></a></li>
5
- <% end %>
6
- </ul>
@@ -1,10 +0,0 @@
1
- @import "styles/tools";
2
-
3
- @include css-reset();
4
- @include grid();
5
-
6
- body {
7
- font-family: Helvetica, Sans-Serif;
8
- width: 960px;
9
- margin: 0 auto;
10
- }
@@ -1,3 +0,0 @@
1
- %div.post
2
- %div.title= post.title
3
- %div.content= post.body
@@ -1,6 +0,0 @@
1
- %ul
2
- - posts.each do |post|
3
- %li= post.title
4
-
5
- = render 'pager_control'
6
-
@@ -1,33 +0,0 @@
1
- !!! 5
2
- %html( lang="en" )
3
- %head
4
- %meta( charset="utf-8" )
5
- %title= data.config.title
6
- /[if le IE 9]
7
- %script( src="http://html5shiv.googlecode.com/svn/trunk/html5.js" )
8
- %link( rel="stylesheet" href="#{uri 'theme/screen.css'}" type="text/css" media="screen" charset="utf-8")
9
- %script( src="#{uri 'theme/scripts/app.js'}" )
10
- %body
11
- .row
12
- .col.span-12
13
- %header
14
- %h1= data.config.title
15
- %h4= data.config.tagline
16
- .row
17
- .col.span-12
18
- %nav
19
- %ul
20
- %li
21
- %a(href="#{uri 'index.html'}") Home
22
- %article
23
- .row
24
- .col.span-8
25
- %section
26
- = content
27
- .col.span-4
28
- %aside
29
- = render 'sidebar'
30
- .row
31
- .col.span-12
32
- %footer
33
- = copyright_years 2010
@@ -1 +0,0 @@
1
- <p>A Message: <%= info %></p>
@@ -1,4 +0,0 @@
1
- title: My Site
2
- tagline: My home on thar intarwebs!
3
- author: Matt McCray
4
- url: http://www.mysite.com
@@ -1,62 +0,0 @@
1
- # Any specialized code for your site goes here...
2
-
3
- puts "Build: #{Gumdrop.data.config.title} (gumdrop v#{Gumdrop::VERSION})"
4
-
5
- if defined? Encoding
6
- Encoding.default_internal = Encoding.default_external = "UTF-8"
7
- else
8
- $KCODE = "UTF-8"
9
- end
10
-
11
- require 'slim'
12
- Slim::Engine.set_default_options pretty:true
13
-
14
- # If you want to specify custom stitch compilers, uncomment this:
15
- #require 'stitch_compilers'
16
-
17
- generate do
18
-
19
- stitch 'app.js', :identifier=>'app', :paths=>['./app'], :root=>'./app', :prune=>false, :compress=>false
20
- stitch 'lib.js', :identifier=>'lib', :paths=>['./lib/javascript'], :root=>'./lib/javascript', :prune=>true, :compress=>false
21
-
22
- # Create minified 'production' versions
23
- stitch 'app-min.js', :identifier=>'app', :paths=>['./app'], :root=>'./app', :prune=>false, :compress=>true
24
- #stitch 'lib.min.js', :identifier=>'lib', :paths=>['./lib/javascript'], :root=>'./lib/javascript', :prune=>true, :compress=>true
25
-
26
-
27
- # Examples of other generatory things:
28
- #
29
- # page "about.html", :template=>'about', :passthru=>'Available in the template' # requires a about.template.XX file
30
- #
31
- # page 'robots.txt' do
32
- # # And content returned will be put in the file
33
- # """
34
- # User-Agent: *
35
- # Disallow: /
36
- # """
37
- # end
38
- #
39
- # stitch 'app.js', :paths=>['source/app_src'], :root=>'source/app_src', :compress=>true, :prune=>true # Prune will remove the source files from the output tree -- you can add :dependencies=>['dir'] too
40
- #
41
- # # Maybe for a tumblr-like pager
42
- # pager= Gumdrop.data.pager_for :posts, base_path:'posts/page', page_size:5
43
- # pager.each do |page|
44
- # page "#{page.uri}.html", template:'post_page', posts:page.items, pager:pager, current_page:pager.current_page
45
- # end
46
-
47
- end
48
-
49
- # Example of skipping a source file from compilation (stitch ignores this setting)
50
- # skip 'file-to-ignore.html'
51
-
52
- # Example of using a content filter to compress CoffeeScript/JS output
53
- # require 'jsmin'
54
- # content_filter do |content, info|
55
- # if info.ext == '.js'
56
- # puts " Compress: #{info.filename}"
57
- # JSMin.minify content
58
- # else
59
- # content
60
- # end
61
- # end
62
-
@@ -1 +0,0 @@
1
- # You can add your own stitch compilers here...
@@ -1,17 +0,0 @@
1
- module Gumdrop::ViewHelpers
2
-
3
- # Calculate the years for a copyright
4
- def copyright_years(start_year, divider="&#8211;")
5
- end_year = Date.today.year
6
- if start_year == end_year
7
- "#{start_year}"
8
- else
9
- "#{start_year}#{divider}#{end_year}"
10
- end
11
- end
12
-
13
- #
14
- # Your custom helpers go here!
15
- #
16
-
17
- end
@@ -1,4 +0,0 @@
1
- title: My Site
2
- tagline: My home on thar intarwebs!
3
- author: Matt McCray
4
- url: http://www.mysite.com
@@ -1,50 +0,0 @@
1
- # Any specialized code for your site goes here...
2
-
3
- puts "Build: #{Gumdrop.data.config.title} (gumdrop v#{Gumdrop::VERSION})"
4
-
5
- if defined? Encoding
6
- Encoding.default_internal = Encoding.default_external = "UTF-8"
7
- else
8
- $KCODE = "UTF-8"
9
- end
10
-
11
- require 'slim'
12
- Slim::Engine.set_default_options pretty:true
13
-
14
- # Example of using a content filter to compress CoffeeScript/JS output
15
- # require 'jsmin'
16
- # content_filter do |content, info|
17
- # if info.ext == '.js'
18
- # puts " Compress: #{info.filename}"
19
- # JSMin.minify content
20
- # else
21
- # content
22
- # end
23
- # end
24
-
25
-
26
- # Example site-level generator
27
- # generate do
28
- #
29
- # page "about.html", :template=>'about', :passthru=>'Available in the template' # requires a about.template.XX file
30
- #
31
- # page 'robots.txt' do
32
- # # And content returned will be put in the file
33
- # """
34
- # User-Agent: *
35
- # Disallow: /
36
- # """
37
- # end
38
- #
39
- # stitch 'app.js', :identifier=>'app', :paths=>['source/app_src'], :root=>'source/app_src', :compress=>true, :prune=>true # Prune will remove the source files from the output tree -- you can add :dependencies=>['dir'] too
40
- #
41
- # # Maybe for a tumblr-like pager
42
- # pager= Gumdrop.data.pager_for :posts, base_path:'posts/page', page_size:5
43
- # pager.each do |page|
44
- # page "#{page.uri}.html", template:'post_page', posts:page.items, pager:pager, current_page:pager.current_page
45
- # end
46
- #
47
- # end
48
-
49
- # Example of skipping a source file from compilation (stitch ignores this setting)
50
- # skip 'file-to-ignore.html'
@@ -1,17 +0,0 @@
1
- module Gumdrop::ViewHelpers
2
-
3
- # Calculate the years for a copyright
4
- def copyright_years(start_year, divider="&#8211;")
5
- end_year = Date.today.year
6
- if start_year == end_year
7
- "#{start_year}"
8
- else
9
- "#{start_year}#{divider}#{end_year}"
10
- end
11
- end
12
-
13
- #
14
- # Your custom helpers go here!
15
- #
16
-
17
- end
@@ -1 +0,0 @@
1
- <p>Welcome to <%= data.config.title %></p>
@@ -1,434 +0,0 @@
1
- // Layout Tools v 1.2
2
-
3
- // Sample Usage:
4
- // #container {
5
- // @include border-radius(5px);
6
- // }
7
-
8
- // GRID
9
-
10
- // = The 1Kb Grid = (slightly modified)
11
- @mixin grid($columns:12, $column_width:60, $column_margin:20) {
12
- .row, section {
13
- overflow: hidden;
14
- margin: 0 auto;
15
- width: #{$columns * $column_width + $columns * $column_margin}px;
16
-
17
- .row {
18
- margin: 0 #{$column_margin - $column_margin * 1.5}px;
19
- display: inline-block;
20
- width: auto;
21
- }
22
-
23
- .col {
24
- margin: 0 #{$column_margin / 2}px;
25
- overflow: hidden;
26
- float: left;
27
- display: inline;
28
- width: #{$column_width * 1 + $column_margin * (1 - 1)}px;
29
-
30
- @for $i from 2 through $columns {
31
- &.span-#{$i} {
32
- width: #{$column_width * $i + $column_margin * ($i - 1)}px;
33
- //&:hover
34
- // outline: 1px solid red
35
- }
36
- }
37
- }
38
- }
39
- }
40
-
41
- // TEST
42
- @mixin gridTest($columns:12, $column_width:60, $column_margin:20) {
43
- row {
44
- display: block;
45
- overflow: hidden;
46
- margin: 0 auto;
47
- width: #{$columns * $column_width + $columns * $column_margin}px;
48
-
49
- row {
50
- margin: 0 #{$column_margin - $column_margin * 1.5}px;
51
- display: inline-block;
52
- width: auto;
53
- }
54
-
55
- col {
56
- margin: 0 #{$column_margin / 2}px;
57
- overflow: hidden;
58
- float: left;
59
- display: inline;
60
- width: #{$column_width * 1 + $column_margin * (1 - 1)}px;
61
- }
62
- @for $i from 2 through $columns {
63
- col#{$i} {
64
- margin: 0 #{$column_margin / 2}px;
65
- overflow: hidden;
66
- float: left;
67
- display: inline;
68
- width: #{$column_width * $i + $column_margin * ($i - 1)}px;
69
- //&:hover
70
- // outline: 1px solid red
71
- }
72
- }
73
- }
74
- }
75
-
76
- // CSS RESET
77
-
78
- @mixin css-clear($boxmodel:'border-box') {
79
- * {
80
- @include box-model($boxmodel);
81
- }
82
- body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td {
83
- margin:0;
84
- padding:0;
85
- }
86
- article, aside, dialog, figure, footer, header, hgroup, menu, nav, section {
87
- display: block;
88
- }
89
- table {
90
- border-collapse:collapse;
91
- border-spacing:0;
92
- }
93
- fieldset,img {
94
- border:0;
95
- }
96
- address,caption,cite,code,dfn,em,strong,th,var {
97
- font-style:normal;
98
- font-weight:normal;
99
- }
100
- ol,ul {
101
- list-style:none;
102
- }
103
- caption,th {
104
- text-align:left;
105
- }
106
- h1,h2,h3,h4,h5,h6 {
107
- font-size:100%;
108
- font-weight:normal;
109
- }
110
- q:before,q:after {
111
- content:'';
112
- }
113
- abbr,acronym {
114
- border:0;
115
- }
116
- }
117
-
118
- @mixin css-reset($size:14px, $boxmodel:'border-box') {
119
- @include css-clear($boxmodel);
120
- body {
121
- font-size: $size;
122
- line-height: 1.3em;
123
- }
124
- h1, h2, h3, h4, h5, h6 {
125
- font-weight: bold;
126
- }
127
- h1 {
128
- font-size: 175%;
129
- }
130
- h2 {
131
- font-size: 155%;
132
- }
133
- h3 {
134
- font-size: 135%;
135
- }
136
- h4 {
137
- font-size: 120%;
138
- }
139
- h5 {
140
- font-size: 105%;
141
- }
142
- h6 {
143
- font-size: 100%;
144
- }
145
- p, blockquote, h1, h2, h3, h4, h5, h6, pre, ol, ul {
146
- padding: 0.5em 0;
147
- }
148
- b, strong {
149
- font-weight: bold;
150
- }
151
- i, em {
152
- font-style: italic;
153
- }
154
- ul, ol {
155
- padding-left: 2em;
156
- }
157
- ul {
158
- list-style: circle;
159
- }
160
- ol {
161
- list-style: decimal;
162
- }
163
- blockquote {
164
- padding-left: 4em;
165
- }
166
- }
167
-
168
- @mixin debug-hover($color:'red') {
169
- &:hover {
170
- outline: 1px solid $color;
171
- }
172
- }
173
-
174
-
175
- // Vertical Background Gradient
176
- @mixin vbg-gradient($fc: #FFF, $tc: #FFF) {
177
- background: $fc;
178
- background: -webkit-gradient(linear, left top, left bottom, from($fc), to($tc));
179
- background: -moz-linear-gradient(top, $fc, $tc);
180
- }
181
-
182
- // Vertical Background Gradient, 3 color
183
- @mixin vbg-gradient3($fc: #FFF, $mc: #FFF, $tc: #FFF) {
184
- background: $fc;
185
- background: -webkit-gradient(linear, left top, left bottom, from($fc), color-stop(0.5, $mc), to($tc));
186
- background: -moz-linear-gradient(top, $fc, $mc, $tc);
187
- }
188
-
189
- // Horizontal Background Gradient
190
- @mixin hbg-gradient($fc: #FFF, $tc: #FFF) {
191
- background: $fc;
192
- background: -webkit-gradient(linear, left top, right top, from($fc), to($tc));
193
- background: -moz-linear-gradient(left, $fc, $tc);
194
- }
195
-
196
-
197
- // Box Model
198
- @mixin box-model($type:'border-box') {
199
- box-sizing: $type;
200
- -moz-box-sizing: $type;
201
- -ms-box-sizing: $type;
202
- -webkit-box-sizing: $type;
203
- }
204
-
205
- @mixin hbox ($boxAlign:stretch, $boxPack:left) {
206
- @include display-box();
207
- @include box-orient(horizontal);
208
- @include box-align($boxAlign);
209
- @include box-pack($boxPack);
210
- }
211
-
212
- @mixin vbox ($boxAlign:stretch, $boxPack:left) {
213
- @include display-box();
214
- @include box-orient(vertical);
215
- @include box-align($boxAlign);
216
- @include box-pack($boxPack);
217
- }
218
-
219
- @mixin display-box () {
220
- display: box;
221
- display: -webkit-box;
222
- display: -moz-box;
223
- }
224
-
225
-
226
- @mixin box-flex ($s: 0) {
227
- box-flex: $s;
228
- -webkit-box-flex: $s;
229
- -moz-box-flex: $s;
230
- }
231
-
232
-
233
- @mixin box-orient($dir:horizontal) {
234
- box-orient: $dir;
235
- -webkit-box-orient: $dir;
236
- -moz-box-orient: $dir;
237
- }
238
-
239
- @mixin box-pack($dir:left) {
240
- box-pack: $dir;
241
- -webkit-box-pack: $dir;
242
- -moz-box-pack: $dir;
243
- }
244
-
245
- @mixin box-align($dir:stretch) {
246
- box-align: $dir;
247
- -webkit-box-align: $dir;
248
- -moz-box-align: $dir;
249
- }
250
-
251
- @mixin box-lines($rows:single) {
252
- box-lines: $rows;
253
- -webkit-box-lines: $rows;
254
- -moz-box-lines: $rows;
255
- }
256
-
257
-
258
- // SHADOWS
259
-
260
- // TEXT shadow
261
- @mixin text-shadow($props) {
262
- text-shadow: $props;
263
- -moz-text-shadow: $props;
264
- -webkit-text-shadow: $props; }
265
-
266
- // BOX shadow
267
- @mixin box-shadow($props) {
268
- box-shadow: $props;
269
- -moz-box-shadow: $props;
270
- -webkit-box-shadow: $props; }
271
-
272
- @mixin inset-box-shadow ($h: 0px, $v: 0px, $b: 4px, $c: #333) {
273
- box-shadow: inset $h $v $b $c;
274
- -moz-box-shadow: inset $h $v $b $c;
275
- -webkit-box-shadow: inset $h $v $b $c;
276
- }
277
-
278
- @mixin border-as-shadow($tlc:#000, $brc:#FFF, $width:1px, $style:solid) {
279
- border: {
280
- top: $width $style $tlc;
281
- left: $width $style $tlc;
282
- right: $width $style $brc;
283
- bottom: $width $style $brc;
284
- };
285
- }
286
-
287
-
288
- // BORDER RADIUS
289
-
290
- // All corners
291
- @mixin border-radius($radius) {
292
- border-radius: $radius;
293
- -moz-border-radius: $radius;
294
- -webkit-border-radius: $radius; }
295
-
296
- // Top Right
297
- @mixin border-radius-top-right($radius) {
298
- @include border-radius-top-right($radius); }
299
-
300
- // Bottom Right
301
- @mixin border-radius-bottom-right($radius) {
302
- @include border-radius-bottom-right($radius); }
303
-
304
- // Bottom Left
305
- @mixin border-radius-bottom-left($radius) {
306
- @include border-radius-bottom-left($radius); }
307
-
308
- // Top Left
309
- @mixin border-radius-top-left($radius) {
310
- @include border-radius-top-left($radius); }
311
-
312
- // Top
313
- @mixin border-radius-top($radius) {
314
- @include border-radius-top-left($radius);
315
- @include border-radius-top-right($radius); }
316
-
317
- // Right
318
- @mixin border-radius-right($radius) {
319
- @include border-radius-top-right($radius);
320
- @include border-radius-bottom-right($radius); }
321
-
322
- // Bottom
323
- @mixin border-radius-bottom($radius) {
324
- @include border-radius-bottom-right($radius);
325
- @include border-radius-bottom-left($radius); }
326
-
327
- // Left
328
- @mixin border-radius-left($radius) {
329
- @include border-radius-top-left($radius);
330
- @include border-radius-bottom-left($radius); }
331
-
332
- // Let's setup the rules so we don't have to repeat ourselves
333
- // These are mixins for this mixin and are re-used above
334
- @mixin border-radius-top-right($radius) {
335
- border-top-right-radius: $radius;
336
- -moz-border-radius-topright: $radius;
337
- -webkit-border-top-right-radius: $radius; }
338
-
339
- @mixin border-radius-bottom-right($radius) {
340
- border-bottom-right-radius: $radius;
341
- -moz-border-radius-bottomright: $radius;
342
- -webkit-border-bottom-right-radius: $radius; }
343
-
344
- @mixin border-radius-bottom-left($radius) {
345
- border-bottom-left-radius: $radius;
346
- -moz-border-radius-bottomleft: $radius;
347
- -webkit-border-bottom-left-radius: $radius; }
348
-
349
- @mixin border-radius-top-left($radius) {
350
- border-top-left-radius: $radius;
351
- -moz-border-radius-topleft: $radius;
352
- -webkit-border-top-left-radius: $radius; }
353
-
354
- @mixin animate($name, $dur:1s, $easing:ease-in-out, $iter:infinite, $dir:alternate) {
355
- -webkit-animation-name: $name;
356
- -webkit-animation-duration: $dur;
357
- -webkit-animation-direction: $dir;
358
- -webkit-animation-iteration-count: $iter;
359
- -webkit-animation-timing-function: $easing;
360
- }
361
-
362
- @mixin transition($info:all 250 ease-out) {
363
- -webkit-transition: $info;
364
- -moz-transition: $info;
365
- -o-transition: $info;
366
- transition: $info;
367
- }
368
-
369
- @mixin transform( $s:'rotate(45deg)') {
370
- -moz-transform: $s;
371
- -webkit-transform: $s;
372
- -o-transform: $s;
373
- transform: $s;
374
- }
375
-
376
- @mixin box-attrs() {
377
- *[box-flex="0"] { @include box-flex(0); }
378
- *[box-flex="1"] { @include box-flex(1); }
379
- *[box-flex="2"] { @include box-flex(2); }
380
- *[box-flex="3"] { @include box-flex(3); }
381
- *[box-flex="4"] { @include box-flex(4); }
382
- *[box-flex="5"] { @include box-flex(5); }
383
- *[box-flex="6"] { @include box-flex(6); }
384
- *[box-flex="7"] { @include box-flex(7); }
385
- *[box-flex="8"] { @include box-flex(8); }
386
- *[box-flex="9"] { @include box-flex(9); }
387
- *[box-flex="10"] { @include box-flex(10); }
388
-
389
- *[box-align="start"] { @include box-align(start); }
390
- *[box-align="center"] { @include box-align(center); }
391
- *[box-align="end"] { @include box-align(end); }
392
- *[box-align="baseline"] { @include box-align(baseline); }
393
- *[box-align="stretch"] { @include box-align(stretch); }
394
-
395
- *[box-pack="start"] { @include box-pack(start); }
396
- *[box-pack="center"] { @include box-pack(center); }
397
- *[box-pack="end"] { @include box-pack(end); }
398
- *[box-pack="justify"] { @include box-pack(justify); }
399
- *[box-pack="stretch"] { @include box-pack(justify); }
400
-
401
- *[box-lines="single"] { @include box-lines(single); }
402
- *[box-lines="multiple"] { @include box-lines(multiple); }
403
-
404
- *[box-orient="horizontal"] { @include box-orient(horizontal); }
405
- *[box-orient="vertical"] { @include box-orient(vertical); }
406
-
407
- }
408
-
409
- // Font stuff
410
-
411
- @mixin web-font($family, $url, $format:'truetype') {
412
- @font-face {
413
- font-family: $family;
414
- src: url($url) format($format);
415
- }
416
- }
417
-
418
- // Color stuff
419
-
420
- @function strengthen($color, $multiplier: 1, $reversed: $reversed-text) {
421
- @if $reversed {
422
- @return lighten($color, 20% * $multiplier);
423
- } @else {
424
- @return darken($color, 20% * $multiplier);
425
- }
426
- }
427
-
428
- @function soften($color, $multiplier: 1, $reversed: $reversed-text) {
429
- @if $reversed {
430
- @return darken($color, 20% * $multiplier);
431
- } @else {
432
- @return lighten($color, 20% * $multiplier);
433
- }
434
- }