compass-example 1.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.
data/CHANGELOG.md ADDED
File without changes
data/README.md ADDED
@@ -0,0 +1,47 @@
1
+ Compass Extension Example
2
+ ==========================
3
+
4
+ There are a lot of cool things that Sass and Compass can do. This is a little compass extension that shows examples on how to fully utilize Compass and Sass to create your own extensions to use.
5
+
6
+ ## How can I use this?
7
+
8
+ Look at it, install it, and see how it is used and how to utilize it yourself. Then make your own. I recomend starting with [Team Sass' extension template](https://github.com/Team-Sass/Compass-Extension-Template).
9
+
10
+ ## What is inside?
11
+
12
+ There is example code on the following areas:
13
+
14
+ ### Creating Compass extensions
15
+
16
+ ### Using Compass extensions to make templates
17
+
18
+ ### How to write Sass Code
19
+ * Variables
20
+ * Functions
21
+ * Mixins
22
+ * Logical Expressions
23
+ * Debugging
24
+
25
+ ### TODO: How to publish your extension
26
+
27
+
28
+ ## What other resources are there?
29
+
30
+ The internet. Google is your friend. Below are some helpful links of places that have excellent help.
31
+
32
+ * [Sass homepage](http://sass-lang.com/)
33
+ * [Sass Documentation](http://sass-lang.com/docs/yardoc/_index.html)
34
+ * [Compass homepage](http://compass-style.org/)
35
+ * The Github repositories of [Team Sass](https://github.com/Team-Sass) contain excellent examples of top-notch extensions.
36
+
37
+
38
+
39
+ <hr>
40
+
41
+ ## Special Thanks
42
+ Super special thanks goes out to [Nathan Weizenbaum](https://github.com/nex3/) for Sass, [Chris Eppstein](https://github.com/chriseppstein/) for Compass, and [Mason Wendell](https://github.com/canarymason/), [Scott Kellum](https://github.com/scottkellum/) and [Sam Richard](https://github.com/canarymason/snugug)--- who are all amazing Sass / Compass developers. Most of the examples here stem from usages in the code they and I have written.
43
+
44
+ ## License
45
+ [Creative Commons Attribution 3.0](http://creativecommons.org/licenses/by/3.0). Go wild.
46
+
47
+ If you're able to link me to your extension so I can see what you've built, that'd be awesome!
data/lib/example.rb ADDED
@@ -0,0 +1,15 @@
1
+ require 'compass'
2
+
3
+ extension_path = File.expand_path(File.join(File.dirname(__FILE__), ".."))
4
+ Compass::Frameworks.register('example', :path => extension_path)
5
+
6
+
7
+ module Example
8
+ VERSION = "1.0"
9
+ DATE = "2013-03-10"
10
+ end
11
+
12
+
13
+ # module Sass::Script::Functions
14
+ #
15
+ # end
@@ -0,0 +1,8 @@
1
+ // Welcome to the example Compass extension. It's purpose is just to show you
2
+ // how to do things. Go wild in each sub-file...
3
+
4
+ @import 'examples/variables';
5
+ @import 'examples/functions';
6
+ @import 'examples/mixins';
7
+ @import 'examples/logic';
8
+ @import 'examples/debugging';
@@ -0,0 +1,28 @@
1
+ //////////////////////////////
2
+ //// Debugging
3
+ //////////////////////////////
4
+
5
+ // Warnings can be set within code in case the user is using incorrect syntax.
6
+ // The Sass file will still compile, this is just a warning to alert the user of
7
+ // their deeds.
8
+ @function display-warning-message($do_it: TRUE) {
9
+ @if ($do_it) {
10
+ // We use the @warn directive to display a message when the file compiles.
11
+ @warn "This is an example warning message";
12
+ }
13
+ @else {
14
+ @warn "Why you no want?";
15
+ }
16
+
17
+ @return $do_it;
18
+ }
19
+
20
+ // Debug messages can be set using the @debug directive, similar to @warn.
21
+ @function display-debug-message($example_value: FALSE) {
22
+ @if ($example_value) {
23
+ // The value has been set, let's put it into a debug message.
24
+ @debug "The value sent to this function is: " $example_value;
25
+ }
26
+
27
+ @return $example_value;
28
+ }
@@ -0,0 +1,21 @@
1
+ //////////////////////////////
2
+ //// Functions
3
+ //////////////////////////////
4
+
5
+ // Function are similar to functions in other languages. They perform some sort
6
+ // of mathematical or logical computation, and return a value.
7
+
8
+ // Functions begin with an @function then the function name.
9
+ @function darker-color($color) { // Each input variable must be assigned within the parentheses.
10
+ // All functions must have an @return directive with a final value.
11
+ @return darken($color, 20%);
12
+ }
13
+
14
+ // A default value may be selected by adding either a variable or value.
15
+ @function addition-example(
16
+ $first: 5,
17
+ $second : $default-add
18
+ ) {
19
+
20
+ @return $first + $second;
21
+ }
@@ -0,0 +1,55 @@
1
+ //////////////////////////////
2
+ //// Logic / Control Directives
3
+ //////////////////////////////
4
+
5
+
6
+ // Basic logic can be added into a function and mixin.
7
+ @function is-it-bigger-than-5($variable) {
8
+ // @if can be added in to check the truthiness.
9
+ @if ($variable > 5) {
10
+ @return TRUE;
11
+ } // An if can be extended with a @else if.
12
+ @else if (type-of($variable) != 'number') { // type-of can be used to determine the type of a variable.
13
+ @return null;
14
+ } // Finally, @else can be used if no if's are true.
15
+ @else {
16
+ @return FALSE;
17
+ }
18
+ }
19
+
20
+ // For loops can be created to go through a number of items.
21
+ @mixin example-for-loop() {
22
+ // @for $variable_name from {starting number} through {ending number}.
23
+ @for $i from 8 through 10 {
24
+ // To include a varible within a string, wrap it in #{$variable}
25
+ .item-#{$i} {
26
+ -foo: $i;
27
+ }
28
+ }
29
+ }
30
+
31
+ // @each can be used to itterate over a list variable.
32
+ @function is-there-a-number-in-my-list($list) {
33
+ @if (type-of($list) != 'list') {
34
+ @return FALSE;
35
+ }
36
+
37
+ // @each $list-item-variable in $list-variable.
38
+ @each $item in $list {
39
+ @if (type-of($item) == 'number') {
40
+ @return TRUE;
41
+ }
42
+ }
43
+
44
+ @return FALSE;
45
+ }
46
+
47
+ // @while can be used to itterate until the expression is false.
48
+ @mixin lets-get-it-to-zero($number: 5) {
49
+ @while $number > 0 {
50
+ .while-loop-#{$number} {
51
+ -bar: 100% / $number;
52
+ }
53
+ $number: $number - 1;
54
+ }
55
+ }
@@ -0,0 +1,24 @@
1
+ //////////////////////////////
2
+ //// Mixins
3
+ //////////////////////////////
4
+
5
+ // Mixins do not return values, but instead print out CSS.
6
+ // Anything within the mixin will be printed out just like if it were added to
7
+ // the Sass file itself.
8
+ @mixin right-to-left() {
9
+ html[dir="rtl"] & {
10
+ @content;
11
+ }
12
+ }
13
+
14
+ // Mixins can also have paramaters when they are set up.
15
+ @mixin example-create-button($color) {
16
+ padding: 1em 3em;
17
+ margin: .5em 1em;
18
+ cursor: pointer;
19
+ color: $color;
20
+
21
+ // Other functions or mixins can also be called within a mix.
22
+ border: 2px solid darker-color($color);
23
+ @include border-radius(5px);
24
+ }
@@ -0,0 +1,41 @@
1
+ //////////////////////////////
2
+ //// Variables
3
+ //////////////////////////////
4
+
5
+ // Declare a variable by having the $variable_name followed by a colon. For
6
+ // variables within your extension, you also want to add '!default' before the
7
+ // semicolon. This will only set the variable if it has not been set already.
8
+ $foo : 'bar' !default;
9
+ $default-add : 2 !default;
10
+
11
+ // There are several types of variables within Sass. Each has their own use.
12
+
13
+ // Numbers simple decimal numbers, with or without units attached to them.
14
+ $number : 1.5 !default;
15
+ $number-unit : 2.2em !default;
16
+
17
+ // Strings of text can have quotes or not.
18
+ $string-1 : foo !default;
19
+ $string-2 : 'bar' !default;
20
+ $string-3 : "gold" !default;
21
+
22
+ // Colors are set with either a string keyword, the Hex code or RGBA value.
23
+ $color-1 : red !default;
24
+ $color-2 : #66B360 !default;
25
+ $color-3 : rgba(255, 255, 0, 0.75) !default;
26
+
27
+ // Booleans are just true, or false.
28
+ $true : true !default;
29
+ $false : false !default;
30
+
31
+ // Variables can also be set to null.
32
+ $null : null !default;
33
+
34
+ // Lists are any of the previous variables within a comma-seperated or spaced
35
+ // list. They can be used for multiple values, or font families.
36
+ $list-space : 1em 2em 3em 4em !default;
37
+ $list-comma : Arial, Helvetica, "Nimbus Sans L", sans-serif !default;
38
+
39
+ // A list can also have a list inside it:
40
+ $list-list : "type-1" 1em 2em,
41
+ "type-2" 3em 4em !default;
@@ -0,0 +1,3 @@
1
+ // Just a sample JavaScript file.
2
+
3
+ document.write("Hello World!");
@@ -0,0 +1,23 @@
1
+ # Description
2
+ description "Description of your Compass Template"
3
+
4
+ # Stylesheets
5
+ file 'screen.scss', :like => :stylesheet, :media => 'screen, projection'
6
+
7
+ # JavaScript
8
+ file 'javascript.js', :like => :javascript, :to => 'scripts.js'
9
+
10
+ # Compass Extension Help
11
+ help %Q{
12
+ Having trouble with this? Well it is just an example! Go read more http://github.com/ChinggizKhan
13
+ }
14
+
15
+ # Compass Extension Welcome Message
16
+ # Users will see this when they create a new project using this template.
17
+ welcome_message %Q{
18
+
19
+ Welcome to an example compass extension!
20
+
21
+ It is here just to show you how to do things and probably shouldn't be used on your projects.
22
+
23
+ }
@@ -0,0 +1,4 @@
1
+ // This file will get output into the user's Sass folder.
2
+ @import "example";
3
+
4
+
metadata ADDED
@@ -0,0 +1,109 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: compass-example
3
+ version: !ruby/object:Gem::Version
4
+ hash: 15
5
+ prerelease:
6
+ segments:
7
+ - 1
8
+ - 0
9
+ version: "1.0"
10
+ platform: ruby
11
+ authors:
12
+ - Ian Carrico
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2013-03-10 00:00:00 Z
18
+ dependencies:
19
+ - !ruby/object:Gem::Dependency
20
+ name: sass
21
+ prerelease: false
22
+ requirement: &id001 !ruby/object:Gem::Requirement
23
+ none: false
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ hash: 15
28
+ segments:
29
+ - 3
30
+ - 2
31
+ - 0
32
+ version: 3.2.0
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: compass
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ hash: 45
44
+ segments:
45
+ - 0
46
+ - 12
47
+ - 1
48
+ version: 0.12.1
49
+ type: :runtime
50
+ version_requirements: *id002
51
+ description: A example compass extension to show how to build you own.
52
+ email:
53
+ - github@iancarrico.com
54
+ executables: []
55
+
56
+ extensions: []
57
+
58
+ extra_rdoc_files: []
59
+
60
+ files:
61
+ - README.md
62
+ - CHANGELOG.md
63
+ - lib/example.rb
64
+ - stylesheets/_example.scss
65
+ - stylesheets/examples/_debugging.scss
66
+ - stylesheets/examples/_logic.scss
67
+ - stylesheets/examples/_mixins.scss
68
+ - stylesheets/examples/_variables.scss
69
+ - stylesheets/examples/_functions.scss
70
+ - templates/project/javascript.js
71
+ - templates/project/screen.scss
72
+ - templates/project/manifest.rb
73
+ homepage:
74
+ licenses: []
75
+
76
+ post_install_message:
77
+ rdoc_options: []
78
+
79
+ require_paths:
80
+ - lib
81
+ required_ruby_version: !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ hash: 3
87
+ segments:
88
+ - 0
89
+ version: "0"
90
+ required_rubygems_version: !ruby/object:Gem::Requirement
91
+ none: false
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ hash: 23
96
+ segments:
97
+ - 1
98
+ - 3
99
+ - 6
100
+ version: 1.3.6
101
+ requirements: []
102
+
103
+ rubyforge_project: compass-example
104
+ rubygems_version: 1.8.15
105
+ signing_key:
106
+ specification_version: 3
107
+ summary: A simple compass extension gem with documentation on the many wonders an extension can provide.
108
+ test_files: []
109
+