compass-inline-gradient 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: cf408b019f4f01a946f17c583879b6971fcdc364
4
+ data.tar.gz: a9caf3bf98b0a09c325ac6830070c05a72373c94
5
+ SHA512:
6
+ metadata.gz: 370f985df99fd1b7596dacddee7064fa0a0653565f2d269352dfb535bf352395ea1e4e55759f89a111a3f14a2c6d1dc73a3f8f93a674f68350a9cec290cf2037
7
+ data.tar.gz: 4eea16b3b3dc4e89c1be3e38b75e2ab5e15283feee1e4ccd0b34ae55f03be66bcb7dc53a38f6e510b5d6fba4e7c28f720b37075ec6eb76b332272e936cc57916
@@ -0,0 +1,20 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ .idea
19
+ .sass-cache
20
+ .DS_Store
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in compass-inline-gradient.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Alexander Pinchuk
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,60 @@
1
+ = Compass::InlineGradient
2
+
3
+ === It's a alpha release. Next week (22 - 28 July 2013) I will release beta version with:
4
+ * Full linear gradient support (now don't work as native angles like 23deg, 58deg and other customs)
5
+ * Multiple gradients (like multiple backgrounds)
6
+ * Radial gradient support
7
+ * W3C closest-side syntax
8
+
9
+ This is a compass/sass extension for inline(data uri) linear gradients with already image optimization.
10
+ It converts css linear gradient syntax to data uri (base64) background-image.
11
+
12
+ === Why use base64 background-images not native gradient?
13
+ Native css gradients have a lot of prefixes, you must use filters for IE, IE9 and Opera needs inline svg gradients.
14
+ Just look at {this}[http://www.colorzilla.com/gradient-editor/] terrible default example.
15
+
16
+ But data uri (base64) has a excellent support. It's just don't work in IE 7-, and work fine in other browsers: desktop, mobile, everywhere.
17
+ You will have less code and more browser support. Use it!
18
+
19
+ *N.B.* inline-gradient function already using {TinyPNG API}[tinypng.org] for image optimization.
20
+
21
+ *P.S.* I need this function more than anyone :) Stay online with me!
22
+
23
+ == Installation
24
+
25
+ Add this line to your application's Gemfile:
26
+
27
+ gem 'compass-inline-gradient'
28
+
29
+ And then execute:
30
+
31
+ $ bundle
32
+
33
+ Or install it yourself as:
34
+
35
+ $ gem install compass-inline-gradient
36
+
37
+ == Usage
38
+
39
+ See *example/example.html* for more information and ready examples.
40
+
41
+ Code examples:
42
+
43
+ some-css-selector {
44
+ background-image: inline-gradient(linear, 200, 100, 90deg, red 0, green 100px, blue 200px);
45
+ }
46
+
47
+ some-css-selector {
48
+ background-image: inline-gradient(linear, 200, 70, to left, red 0%, orange 16.67%, yellow 33.34%, green 50%, lightskyblue 66.67%, blue 83.33%, violet 100%);
49
+ }
50
+
51
+ == Contributing
52
+
53
+ 1. Fork it
54
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
55
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
56
+ 4. Push to the branch (`git push origin my-new-feature`)
57
+ 5. Create new Pull Request
58
+
59
+ == Other
60
+ Add issues, I always answer.
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'inline-gradient'
5
+ require 'inline-gradient/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = "compass-inline-gradient"
9
+ spec.version = InlineGradient::VERSION
10
+ spec.authors = ["Alexander Pinchuk"]
11
+ spec.email = ["front.end.developing@gmail.com"]
12
+ spec.description = "Sass/Compass extension to convert css3 gradient to base64"
13
+ spec.summary = "Convert css3 gradient to base64 hash"
14
+ spec.homepage = "https://github.com/frontenddeveloping/compass-inline-gradient"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files`.split($/)
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.3"
23
+ spec.add_development_dependency "rake"
24
+ spec.add_development_dependency "sass"
25
+ spec.add_development_dependency "rmagick"
26
+ spec.add_development_dependency "tinypng"
27
+ end
@@ -0,0 +1,5 @@
1
+ require File.join(File.dirname(__FILE__), '../lib/inline-gradient.rb')
2
+
3
+ http_path = "/"
4
+ css_dir = "stylesheets"
5
+ sass_dir = "sass"
@@ -0,0 +1,165 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>Test page for inline-gradient usage in Compass/Sass</title>
6
+ <link rel="stylesheet" href="stylesheets/example.css" type="text/css" >
7
+ <script type="text/javascript" src="vendor/jquery.js"></script>
8
+ <script type="text/javascript" src="vendor/jquery.snippet.js"></script>
9
+ <link rel="stylesheet" type="text/css" href="vendor/jquery.snippet.css" />
10
+ </head>
11
+ <body>
12
+ <div class="notes">
13
+ <div class="toggle"></div>
14
+ <h3 class="notes-header">
15
+ Notes:
16
+ </h3>
17
+ <ol class="notes-list">
18
+ <li class="note">
19
+ Compass inline gradient result is an image (data uri image), it can't be with out fix size.
20
+ If you need to use the same gradient with other sizes try to use CSS rule
21
+ <span class="inline-code">background-size: 100% 100%</span>&nbsp;(<a href="http://caniuse.com/#search=background-size" target="_blank">browser support</a>)
22
+ </li>
23
+ <li class="note">
24
+ inline-gradient is Sass/Compass function. You can use it with out Compass in Sass
25
+ </li>
26
+ <li class="note">
27
+ inline-gradient function use <a href="http://www.w3.org/TR/css3-images/" target="_blank">W3C</a> syntax, there is no support for browser prefix syntax.
28
+ W3C syntax is using for gradient type name(linear/radial), angle/side-to-corner and color-stop values.
29
+ Width and height using in pixels.
30
+ </li>
31
+ </ol>
32
+ </div>
33
+ <div class="examples">
34
+ <div class="example">
35
+ <h2>Default usage example</h2>
36
+ <div class="description">
37
+ Default using (without arguments) is equivalent to calling:<br />
38
+ <span class="inline-code">inline-gradient(linear, 100, 100, to bottom, #FFF 0%, #000 100%)</span>
39
+ </div>
40
+ <div class="result result-default">
41
+ <div class="result-wrapper">
42
+ <h3>Inline</h3>
43
+ <div class="gradient sass-gradient"></div>
44
+ </div>
45
+ <div class="result-wrapper">
46
+ <h3>Browser</h3>
47
+ <div class="gradient native-gradient"></div>
48
+ </div>
49
+ </div>
50
+ <div class="code">
51
+ <pre>
52
+ some_css_selector {
53
+ background-image: inline-gradient();
54
+ }
55
+ </pre>
56
+ </div>
57
+ </div>
58
+ <div class="example">
59
+ <h2>Simple usage example</h2>
60
+ <div class="description">
61
+ Three colors 90deg rotate linear-gradient.<br />
62
+ The same result you can get <span class="inline-code">inline-linear-gradient(200, 100, 90deg, red 0%, green 50%, blue 100%);</span>
63
+ </div>
64
+ <div class="result result-simple">
65
+ <div class="result-wrapper">
66
+ <h3>Inline</h3>
67
+ <div class="gradient sass-gradient"></div>
68
+ </div>
69
+ <div class="result-wrapper">
70
+ <h3>Browser</h3>
71
+ <div class="gradient native-gradient"></div>
72
+ </div>
73
+ </div>
74
+ <div class="code">
75
+ <pre>
76
+ some_css_selector {
77
+ background-image: inline-gradient(linear, 200, 100, 90deg, red 0%, green 50%, blue 100%);
78
+ }
79
+ </pre>
80
+ </div>
81
+ </div>
82
+ <div class="example">
83
+ <h2>Rainbow gradient example</h2>
84
+ <div class="description">
85
+ Rainbow gradient from left to right.<br />
86
+ </div>
87
+ <div class="result result-rainbow">
88
+ <div class="result-wrapper">
89
+ <h3>Inline</h3>
90
+ <div class="gradient sass-gradient"></div>
91
+ </div>
92
+ <div class="result-wrapper">
93
+ <h3>Browser</h3>
94
+ <div class="gradient native-gradient"></div>
95
+ </div>
96
+ </div>
97
+ <div class="code">
98
+ <pre>
99
+ some_css_selector {
100
+ background-image: inline-gradient(linear, 500, 150, to left, red 0%, orange 16.67%, yellow 33.34%, green 50%, lightskyblue 66.67%, blue 83.33%, violet 100%);
101
+ }
102
+ </pre>
103
+ </div>
104
+ </div>
105
+ <div class="example">
106
+ <h2>Rotated example</h2>
107
+ <div class="description">
108
+ Two colors 135deg rotate linear-gradient.<br />
109
+ </div>
110
+ <div class="result result-rotated">
111
+ <div class="result-wrapper">
112
+ <h3>Inline</h3>
113
+ <div class="gradient sass-gradient"></div>
114
+ </div>
115
+ <div class="result-wrapper">
116
+ <h3>Browser</h3>
117
+ <div class="gradient native-gradient"></div>
118
+ </div>
119
+ </div>
120
+ <div class="code">
121
+ <pre>
122
+ some_css_selector {
123
+ background-image: inline-gradient(linear, 100, 100, 135deg, #f90 0%, #c96 100%);
124
+ }
125
+ </pre>
126
+ </div>
127
+ </div>
128
+ <div class="example">
129
+ <h2>Another rotated example</h2>
130
+ <div class="description">
131
+ Two colors -23deg rotate linear-gradient.<br />
132
+ </div>
133
+ <div class="result result-rotated-complex">
134
+ <div class="result-wrapper">
135
+ <h3>Inline</h3>
136
+ <div class="gradient sass-gradient"></div>
137
+ </div>
138
+ <div class="result-wrapper">
139
+ <h3>Browser</h3>
140
+ <div class="gradient native-gradient"></div>
141
+ </div>
142
+ </div>
143
+ <div class="code">
144
+ <pre>
145
+ some_css_selector {
146
+ background-image: inline-gradient(linear, 100, 100, -23deg, #f90 0%, #c96 100%);
147
+ }
148
+ </pre>
149
+ </div>
150
+ </div>
151
+ </div>
152
+ </div>
153
+ <script>
154
+ $(function(){
155
+ $(".code").find("pre").each(function (index,node) {
156
+ var $node = $(node),
157
+ nodeHTML = $node.html();
158
+ //format hack
159
+ $node.html(nodeHTML.replace(/\s{2,}/g, '').replace(/({|;)/g,'$1\n').replace(/background/,' background'));
160
+ $node.snippet("css",{style:"golden"});
161
+ });
162
+ });
163
+ </script>
164
+ </body>
165
+ </html>
@@ -0,0 +1,78 @@
1
+ @import "theme";
2
+
3
+ $randbow-step : 100.0/6;
4
+
5
+ .result-default {
6
+ .sass-gradient,
7
+ .native-gradient {
8
+ height: 100px;
9
+ width: 100px;
10
+ }
11
+ .sass-gradient {
12
+ background-image: inline-gradient();
13
+ }
14
+
15
+ .native-gradient {
16
+ background: linear-gradient(#FFF 0%, #000 100%);
17
+ }
18
+ }
19
+
20
+ .result-simple {
21
+ .sass-gradient,
22
+ .native-gradient {
23
+ height: 100px;
24
+ width: 200px;
25
+ }
26
+ .sass-gradient {
27
+ background-image: inline-gradient(linear, 200, 100, 90deg, red 0, green 100px, blue 200px);
28
+ }
29
+
30
+ .native-gradient {
31
+ background: linear-gradient(90deg, red 0, green 100px, blue 200px);
32
+ }
33
+ }
34
+
35
+ .result-rainbow {
36
+ .sass-gradient,
37
+ .native-gradient {
38
+ height: 70px;
39
+ width: 200px;
40
+ }
41
+ .sass-gradient {
42
+ background-image: inline-gradient(linear, 200, 70, to left, red 0%, orange 16.67%, yellow 33.34%, green 50%, lightskyblue 66.67%, blue 83.33%, violet 100%);
43
+ }
44
+
45
+ .native-gradient {
46
+ background: linear-gradient(to left, red 0%, orange 16.67%, yellow 33.34%, green 50%, lightskyblue 66.67%, blue 83.33%, violet 100%);
47
+ }
48
+ }
49
+
50
+ .result-rotated {
51
+ .sass-gradient,
52
+ .native-gradient {
53
+ height: 100px;
54
+ width: 100px;
55
+ }
56
+ .sass-gradient {
57
+ background-image: inline-gradient(linear, 100, 100, 135deg, #f90 0%, #000 100%);
58
+ }
59
+
60
+ .native-gradient {
61
+ background: linear-gradient(135deg, #f90 0%, #000 100%);
62
+ }
63
+ }
64
+
65
+ .result-rotated-complex {
66
+ .sass-gradient,
67
+ .native-gradient {
68
+ height: 100px;
69
+ width: 200px;
70
+ }
71
+ .sass-gradient {
72
+ background-image: inline-gradient(linear, 200, 100, -23deg, #c0c000 0%, #963 100%);
73
+ }
74
+
75
+ .native-gradient {
76
+ background: linear-gradient(-23deg, #c0c000 0%, #963 100%);
77
+ }
78
+ }
@@ -0,0 +1,102 @@
1
+ @import "compass/css3";
2
+
3
+ * {
4
+ margin: 0;
5
+ padding: 0;
6
+ outline: 0;
7
+ }
8
+
9
+ html, body {
10
+ min-height: 100%;
11
+ height: 100%;
12
+ }
13
+
14
+ body {
15
+ font: 14px/normal Helvetica, Arial, sans-serif;
16
+ }
17
+
18
+ h2 {
19
+ font-family: Georgia;
20
+ font-size: 21px;
21
+ font-weight: lighter;
22
+ }
23
+
24
+ h3 {
25
+ font-family: Georgia;
26
+ font-size: 16px;
27
+ font-weight: lighter;
28
+ padding-bottom: 10px;
29
+ }
30
+
31
+ .code, .inline-code {
32
+ font: 12px/14px monospace, sans-serif;
33
+ }
34
+
35
+ .code {
36
+ clear: both;
37
+ margin-right: 20px;
38
+ }
39
+
40
+ .inline-code {
41
+ @include border-radius(2px);
42
+ background-color: rgba(0,0,0,0.8);
43
+ color: #db0;
44
+ display: inline-block;
45
+ margin: 2px 0;
46
+ padding: 2px 4px;
47
+ }
48
+
49
+ .examples {
50
+ overflow: hidden;
51
+ border-right: 1px solid #ddd;
52
+ margin-right: 400px;
53
+ }
54
+
55
+ .example {
56
+ padding: 20px 10px;
57
+ }
58
+
59
+ .result {
60
+ display: inline-block;
61
+ vertical-align: top;
62
+ }
63
+
64
+ .result-wrapper {
65
+ float: left;
66
+ padding: 0 20px 20px 0;
67
+ }
68
+
69
+ .gradient {
70
+ border: 1px solid #ddd;
71
+ }
72
+
73
+ .description {
74
+ padding: 10px 0;
75
+ }
76
+
77
+ .notes {
78
+ background-color: lemonchiffon;
79
+ border-left: 1px solid #ddd;
80
+ float: right;
81
+ margin-left: -1px;
82
+ min-height: 100%;
83
+ padding: 10px 10px 0;
84
+ position: fixed;
85
+ top: 0;
86
+ right: 0;
87
+ width: 400px;
88
+ }
89
+
90
+ .notes-header {
91
+ padding-bottom: 10px;
92
+ }
93
+
94
+ .notes-list {
95
+ font-size: 12px;
96
+ list-style: inside;
97
+ }
98
+
99
+ .note {
100
+ padding-bottom: 10px;
101
+ }
102
+