Skip to content
This repository has been archived by the owner on Jul 23, 2023. It is now read-only.

Commit

Permalink
added info on lists and extending sass with ruby
Browse files Browse the repository at this point in the history
  • Loading branch information
scottdavis committed Mar 23, 2012
1 parent 72bbbdb commit a7af453
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 0 deletions.
1 change: 1 addition & 0 deletions Gemfile
Expand Up @@ -2,4 +2,5 @@ source :rubygems

gem 'sinatra', '~> 1.3.2'
gem 'attentive', :path => '../attentive'
gem 'thin'

7 changes: 7 additions & 0 deletions Gemfile.lock
Expand Up @@ -61,7 +61,9 @@ GEM
chunky_png (~> 1.2)
fssm (>= 0.2.7)
sass (~> 3.1)
daemons (1.1.8)
erubis (2.7.0)
eventmachine (0.12.10)
execjs (1.3.0)
multi_json (~> 1.0)
ffi (1.0.11)
Expand Down Expand Up @@ -126,6 +128,10 @@ GEM
sprockets (~> 2.0)
tilt (~> 1.1)
sprockets-vendor_gems (0.1.1)
thin (1.3.1)
daemons (>= 1.0.9)
eventmachine (>= 0.12.6)
rack (>= 1.0.0)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
Expand All @@ -139,3 +145,4 @@ PLATFORMS
DEPENDENCIES
attentive!
sinatra (~> 1.3.2)
thin
65 changes: 65 additions & 0 deletions presentation/02_sass.slides
Expand Up @@ -25,6 +25,43 @@

```

!SLIDE

# Lists

``` css
border : 1px solid black;
```

!SLIDE

``` scss
$my-list : 1px solid black;
$my-list2 : 1px, solid, black;
$my-list3 : (1px solid black);

border : $my-list;

```

!SLIDE

# In ruby

``` ruby
Sass::Script::List.new(['1px', 'solid', 'black'], ',')
```

!SLIDE
## List Functions

* `length($list)`
* `nth($list, $n)`
* `join($list1, $list2, [$separator])`
* More coming soon!



!SLIDE mixins

# Functions and Mixins
Expand Down Expand Up @@ -84,3 +121,31 @@ a:hover { color : red; }
}

```

!SLIDE
## Extending with ruby

``` ruby
def sprite(map, sprite, offset_x = ZERO, offset_y = ZERO)
sprite = convert_sprite_name(sprite)
verify_map(map)
unless sprite.is_a?(Sass::Script::String)
raise Sass::SyntaxError
end
url = sprite_url(map)
position = sprite_position(map, sprite, offset_x, offset_y)
Sass::Script::List.new([url] + position.value, :space)
end
Sass::Script::Functions.declare :sprite, [:map, :sprite]
Sass::Script::Functions.declare :sprite, [:map, :sprite, :offset_x]
Sass::Script::Functions.declare :sprite, [:map, :sprite, :offset_x, :offset_y]
```

!SLIDE
## Data types

* Bool
* Color
* List
* Number
* String

0 comments on commit a7af453

Please sign in to comment.