SlideShare une entreprise Scribd logo
1  sur  56
Télécharger pour lire hors ligne
Friday, May 4, 12
Sass, Compass



Friday, May 4, 12
DIE – Duplication is evil
Friday, May 4, 12
.round {
             -webkit-transform: scale(1);
             -moz-transform: scale(1);
             -o-transform: scale(1);
             transform: scale(1);
             }




Friday, May 4, 12
Sass



Friday, May 4, 12
Windows   http://rubyinstaller.org/downloads/
                              $ gem install haml
                              $ gem install haml/edge




                    Mac       $ gem install haml
                              $ gem install haml/edge




                    Linux     $ sudo apt-get install ruby
                              $ gem install haml
                              $ gem install haml/edge




                              Установка
Friday, May 4, 12
$ sass --watch <folder>

            Cледит за изменениями в sass-файлах и компилирует их в css




                      Как это работает
Friday, May 4, 12
$ sass --watch <folder>

            Cледит за изменениями в sass-файлах и компилирует их в css




                       *.sass             *.css




                      Как это работает
Friday, May 4, 12
$ sass --watch <folder>

            Cледит за изменениями в sass-файлах и компилирует их в css




                       *.sass             *.css




                      Как это работает
Friday, May 4, 12
Синтаксис



Friday, May 4, 12
table
               width: 100%
               tr
                td
                   background: #edaeda
                   p
                     font-size: 14px




                SASS — Syntactically Awesome Stylesheets
Friday, May 4, 12
table{
                      width: 100%;
                      tr{
                        td{
                           background: #edaeda;
                           p{
                              font-size: 14px;
                           }
                        }
                      }
                    }




                        SCSS — Sassy CSS
Friday, May 4, 12
SASS — лаконичность
Friday, May 4, 12
SCSS — обратная совместимость
Friday, May 4, 12
Вложенность



Friday, May 4, 12
.sidebar                      .sidebar {
             background: black             background: black;
             h2                          }
               font-size: 20px           .sidebar h2 {
             a                             font-size: 20px
               color: blue               }
               &:hover                   .sidebar a {
                 text-decoration: none     color: blue;
                                         }
                                         .sidebar a:hover {
                                           text-decoration: none;
                                         }




                        Вложенность
Friday, May 4, 12
h2                         h2{
                    font:                   font-style: italic;
                     style: italic          font-weight: bold;
                     weight: bold           font-size: 12px;
                     size: 12px             font-family: sans-serif;
                     family: sans-serif   }




                             Вложенность
Friday, May 4, 12
Переменные



Friday, May 4, 12
$text-color: #edaeda
            $content-text: FUUUUUUUuuuuuu
            $headlines-font: Arial, Helvetica, sans-serif
            $true: false




                      Переменные
Friday, May 4, 12
$width: 500px
                $height: 400px

                .center-absolute
                  background: #f2c98a
                  width: $width
                  height: $height
                  position: absolute
                  left: 50%
                  top: 50%
                  margin-top: -($height/2)
                  margin-left: -($width/2)




                          Переменные
Friday, May 4, 12
$varclass: cahoona

                    .big-#{$varclass}
                        width: 2em




                            Переменные
Friday, May 4, 12
Примеси



Friday, May 4, 12
@mixin font($size)
                 font: $size Georgia, serif

               h1
                    +font(48px)
               p
                    +font(14px)


               h1{
                  font: 48px Georgia, serif;
               }
               p{
                  font: 14px Georgia, serif;
               }




                                  Примеси
Friday, May 4, 12
Функции



Friday, May 4, 12
$color: #f00

            .somebox
                border: 1px solid $color
                box-shadow: 0 0 3px darken($color, 10%),
            inset 1px 0 lighten($color, 40%)


            .somebox {
              border: 1px solid red;
              box-shadow: 0 0 3px #cc0000, inset 1px 0 #ffcccc;
            }




                           Функции
Friday, May 4, 12
.somebox
                   background: rgba(#fff, 0.5)



               .somebox {
                   background: rgba(255, 255, 255, 0.5);
               }




                             Функции
Friday, May 4, 12
rgb($red, $green, $blue)                      lighten($color, $amount)
            rgba($red, $green, $blue, $alpha)             darken($color, $amount)
            rgba($color, $alpha)                          saturate($color, $amount)
            red($color)                                   desaturate($color, $amount)
            green($color)                                 grayscale($color)
            blue($color)                                  complement($color)
            mix($color-1, $color-2, [$weight])            invert($color)

            hsl($hue, $saturation, $lightness)            alpha($color) / opacity($color)
            hsla($hue, $saturation, $lightness, $alpha)   rgba($color, $alpha)
            hue($color)                                   opacify($color, $amount) / fade-in($color, $amount)
            saturation($color)                            transparentize($color, $amount) / fade-out($color, $amount)
            lightness($color)
            adjust-hue($color, $degrees)




                                    Еще функции
Friday, May 4, 12
http://sass-lang.com/docs/yardoc/Sass/Script/Functions.html




                       И еще функции
Friday, May 4, 12
@extend



Friday, May 4, 12
.food
                        background-image: url(food-sprite.png)

                    .food-bacon
                        @extend .food
                        background-position: 0 -10px
                        width: 25px
                        height: 10px

                    .food-pizza
                        @extend .food
                        background-position: 0 -20px
                        width: 45px
                        height: 35px




                                   @extend
Friday, May 4, 12
.food, .food-bacon, .food-pizza{
                      background-image: url(food-sprite.png);
                    }

                    .food-bacon{
                      background-position: 0 -10px;
                      width: 25px;
                      height: 10px;
                    }

                    .food-pizza{
                      background-position: 0 -20px;
                      width: 45px;
                      height: 35px;
                    }




                                   @extend
Friday, May 4, 12
@import



Friday, May 4, 12
master.sass
             @import “main.sass”
             @import “index.sass”
             @import “profile.sass”



           master.css
             main.css + index.css + profile.css




                           @import
Friday, May 4, 12
@if
                    @for, @while
                    @function
                    @each



                            Кроме того
Friday, May 4, 12
http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html




                            Почитать
Friday, May 4, 12
Compass



Friday, May 4, 12
Friday, May 4, 12
.round
            +border-radius(25px)




                          CSS3
Friday, May 4, 12
.round
             +border-radius(25px)


          .round {
             -webkit-border-radius: 25px;
             -moz-border-radius: 25px;
             -o-border-radius: 25px;
             -ms-border-radius: 25px;
             -khtml-border-radius: 25px;
             border-radius: 25px;
             }




                             CSS3
Friday, May 4, 12
.shadow
                       +box-shadow(0 0 4px #ccc)




                    .shadow {
                        -moz-box-shadow: 0 0 4px #cccccc;
                        -webkit-box-shadow: 0 0 4px #cccccc;
                        -o-box-shadow: 0 0 4px #cccccc;
                        box-shadow: 0 0 4px #cccccc;
                    }




                                    CSS3
Friday, May 4, 12
.gradient
       +background-image(linear-gradient(#fff, #ccc 30%, #bbb 70%, #aaa))




    .gradient {
        background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #ffffff),
      color-stop(30%, #cccccc), color-stop(70%, #bbbbbb), color-stop(100%, #aaaaaa));
        background-image: -webkit-linear-gradient(#ffffff, #cccccc 30%, #bbbbbb 70%, #aaaaaa);
        background-image: -moz-linear-gradient(#ffffff, #cccccc 30%, #bbbbbb 70%, #aaaaaa);
        background-image: -o-linear-gradient(#ffffff, #cccccc 30%, #bbbbbb 70%, #aaaaaa);
        background-image: -ms-linear-gradient(#ffffff, #cccccc 30%, #bbbbbb 70%, #aaaaaa);
        background-image: linear-gradient(#ffffff, #cccccc 30%, #bbbbbb 70%, #aaaaaa);
    }




                                       CSS3
Friday, May 4, 12
.beauty-box
          +border-radius(25px)
          +box-shadow(0 0 4px #ccc)
          +background-image(linear-gradient(#fff, #aaa))




                            CSS3
Friday, May 4, 12
.beauty-box {
        -webkit-border-radius: 25px;
        -moz-border-radius: 25px;
        -o-border-radius: 25px;
        -ms-border-radius: 25px;
        -khtml-border-radius: 25px;
        border-radius: 25px;
        -moz-box-shadow: 0 0 4px #cccccc;
        -webkit-box-shadow: 0 0 4px #cccccc;
        -o-box-shadow: 0 0 4px #cccccc;
        box-shadow: 0 0 4px #cccccc;
        background-image: -webkit-gradient(...
        color-stop(30%, #cccccc), color-stop(...
        background-image: -webkit-linear-gradient(...
        background-image: -moz-linear-gradient(...
        background-image: -o-linear-gradient(...
        background-image: -ms-linear-gradient(...
        background-image: linear-gradient(...
    }




                               CSS3
Friday, May 4, 12
Background Clip
                    Background Origin
                    Background Size
                    Box
                    Box Sizing
                    Columns
                    Clearfix
                    Font Face
                    Inline Block
                    Opacity
                    Transition
                    Transform




                                        CSS3
Friday, May 4, 12
http://compass-style.org/reference/compass/css3/




                                      CSS3
Friday, May 4, 12
ico/fb.png   ico/vk.png   ico/twi.png


        $sprite: sprite-map("ico/*.png")

        .fb
          background: sprite($sprite, fb)
        .vk
          background: sprite($sprite, vk)
        .twi
          background: sprite($sprite, twi)




                                       Спрайты
Friday, May 4, 12
ico/fb.png   ico/vk.png   ico/twi.png


        $sprite: sprite-map("ico/*.png")

        .fb
          background: sprite($sprite, fb)
        .vk
          background: sprite($sprite, vk)
        .twi
          background: sprite($sprite, twi)




                                       Спрайты
Friday, May 4, 12
ico/fb.png   ico/vk.png   ico/twi.png


        $sprite: sprite-map("ico/*.png")

        .fb
          background: sprite($sprite, fb)
        .vk
          background: sprite($sprite, vk)
        .twi
          background: sprite($sprite, twi)




                                       Спрайты
Friday, May 4, 12
ico/fb.png   ico/vk.png   ico/twi.png


        $sprite: sprite-map("ico/*.png")

        .fb
          background: sprite($sprite, fb)
        .vk
          background: sprite($sprite, vk)
        .twi
          background: sprite($sprite, twi)




                                       Спрайты
Friday, May 4, 12
ico-s2e5fe71d31.png



        .fb {
          background: url('images/ico-s2e5fe71d31.png') 0 0px no-repeat;
        }
        .vk {
          background: url('images/ico-s2e5fe71d31.png') 0 -41px no-repeat;
        }
        .twi {
          background: url('images/ico-s2e5fe71d31.png') 0 -82px no-repeat;
        }




                              Спрайты
Friday, May 4, 12
ico-s2e5fe71d31.png



        .fb {
          background: url('images/ico-s2e5fe71d31.png') 0 0px no-repeat;
        }
        .vk {
          background: url('images/ico-s2e5fe71d31.png') 0 -41px no-repeat;
        }
        .twi {
          background: url('images/ico-s2e5fe71d31.png') 0 -82px no-repeat;
        }




                              Спрайты
Friday, May 4, 12
ico-s2e5fe71d31.png



        .fb {
          background: url('images/ico-s2e5fe71d31.png') 0 0px no-repeat;
        }
        .vk {
          background: url('images/ico-s2e5fe71d31.png') 0 -41px no-repeat;
        }
        .twi {
          background: url('images/ico-s2e5fe71d31.png') 0 -82px no-repeat;
        }




                              Спрайты
Friday, May 4, 12
.basebox
         background: inline-image("pic.png")




       .basebox {
         background: url('data:image/png;base64,1UcAAA...AASUVORK5CYII=');
       }




                              Base64
Friday, May 4, 12
# You can select your preferred output style here (can be overridden via the
      command line):
      # output_style = :expanded or :nested or :compact or :compressed



      output_style = :compressed




                               Config.rb
Friday, May 4, 12
http://sass-lang.com/
                http://compass-style.org/
                http://chriseppstein.github.com/
                http://nex-3.com/
                http://thesassway.com/




                           Что почитать
Friday, May 4, 12
Спасибо
                    Вопросы?

                                           @llazio
                               sd@evilmartians.com
                               www.evilmartians.ru
                               Дыниовский Сергей

Friday, May 4, 12

Contenu connexe

En vedette

Presentación dia de campo2
Presentación dia de campo2Presentación dia de campo2
Presentación dia de campo2Mandre Ospina
 
Social media platforms and strategies
Social media platforms and strategiesSocial media platforms and strategies
Social media platforms and strategiesUSCCB
 
기업의 마케팅 트위터
기업의 마케팅 트위터기업의 마케팅 트위터
기업의 마케팅 트위터은창 이
 
CIB-PVF Line Card Rev 111
CIB-PVF Line Card Rev 111CIB-PVF Line Card Rev 111
CIB-PVF Line Card Rev 111jeyramyadielis
 
Road safety
Road safetyRoad safety
Road safetyMirmike
 
Pattern based design
Pattern based designPattern based design
Pattern based designUtkarsh Verma
 
Net303 Online Policy Primer of SlideShare.net
Net303 Online Policy Primer of SlideShare.net Net303 Online Policy Primer of SlideShare.net
Net303 Online Policy Primer of SlideShare.net CurtinStud
 
RSS와 SNS를 활용한 마케팅
RSS와 SNS를 활용한 마케팅RSS와 SNS를 활용한 마케팅
RSS와 SNS를 활용한 마케팅은창 이
 
Презентация "новый свет"
Презентация "новый свет"Презентация "новый свет"
Презентация "новый свет"kan6363
 

En vedette (20)

Presentación dia de campo2
Presentación dia de campo2Presentación dia de campo2
Presentación dia de campo2
 
Objetos de la cocina
Objetos de la cocinaObjetos de la cocina
Objetos de la cocina
 
Social media platforms and strategies
Social media platforms and strategiesSocial media platforms and strategies
Social media platforms and strategies
 
Redcross
RedcrossRedcross
Redcross
 
기업의 마케팅 트위터
기업의 마케팅 트위터기업의 마케팅 트위터
기업의 마케팅 트위터
 
CIB-PVF Line Card Rev 111
CIB-PVF Line Card Rev 111CIB-PVF Line Card Rev 111
CIB-PVF Line Card Rev 111
 
Session fixation
Session fixationSession fixation
Session fixation
 
Road safety
Road safetyRoad safety
Road safety
 
Pattern based design
Pattern based designPattern based design
Pattern based design
 
Tugas ke 1
Tugas ke 1Tugas ke 1
Tugas ke 1
 
Tugas ke 5
Tugas ke 5Tugas ke 5
Tugas ke 5
 
805 15-kevin
805 15-kevin805 15-kevin
805 15-kevin
 
805 15-kevin
805 15-kevin805 15-kevin
805 15-kevin
 
Net303 Online Policy Primer of SlideShare.net
Net303 Online Policy Primer of SlideShare.net Net303 Online Policy Primer of SlideShare.net
Net303 Online Policy Primer of SlideShare.net
 
Dumpster diving
Dumpster divingDumpster diving
Dumpster diving
 
RSS와 SNS를 활용한 마케팅
RSS와 SNS를 활용한 마케팅RSS와 SNS를 활용한 마케팅
RSS와 SNS를 활용한 마케팅
 
מצגת יובל
מצגת יובלמצגת יובל
מצגת יובל
 
Resume
ResumeResume
Resume
 
Презентация "новый свет"
Презентация "новый свет"Презентация "новый свет"
Презентация "новый свет"
 
Chapter 8
Chapter 8Chapter 8
Chapter 8
 

Similaire à SASS, Compass 1.1

Wrangling the CSS Beast with Sass
Wrangling the CSS Beast  with SassWrangling the CSS Beast  with Sass
Wrangling the CSS Beast with SassRob Friesel
 
Brian Hoke: WordCamp Toronto 2014 Presentation "Sass & WordPress"
Brian Hoke: WordCamp Toronto 2014 Presentation "Sass & WordPress"Brian Hoke: WordCamp Toronto 2014 Presentation "Sass & WordPress"
Brian Hoke: WordCamp Toronto 2014 Presentation "Sass & WordPress"bentleyhoke
 
Work and play with SASS & Compass
Work and play with SASS & CompassWork and play with SASS & Compass
Work and play with SASS & CompassAndreas Dantz
 
Finding your way with Sass+Compass
Finding your way with Sass+CompassFinding your way with Sass+Compass
Finding your way with Sass+Compassdrywallbmb
 
Simple introduction Sass
Simple introduction SassSimple introduction Sass
Simple introduction SassZeeshan Ahmed
 
Preprocessor presentation
Preprocessor presentationPreprocessor presentation
Preprocessor presentationMario Noble
 
Sassy Stylesheets with SCSS
Sassy Stylesheets with SCSSSassy Stylesheets with SCSS
Sassy Stylesheets with SCSSKathryn Rotondo
 
CSS with LESS for #jd13nl
CSS with LESS for #jd13nlCSS with LESS for #jd13nl
CSS with LESS for #jd13nlHans Kuijpers
 
Drupal & CSS Preprocessors
Drupal & CSS PreprocessorsDrupal & CSS Preprocessors
Drupal & CSS Preprocessorskdmarks
 
Sass - Making CSS fun again.
Sass - Making CSS fun again.Sass - Making CSS fun again.
Sass - Making CSS fun again.Gabriel Neutzling
 
Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version)
Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version)Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version)
Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version)Adam Darowski
 
Building Custom WordPress Themes with Sass - WordCamp Sacramento 2016
Building Custom WordPress Themes with Sass - WordCamp Sacramento 2016Building Custom WordPress Themes with Sass - WordCamp Sacramento 2016
Building Custom WordPress Themes with Sass - WordCamp Sacramento 2016Matt Vanderpol
 
Sass & Compass (Barcamp Stuttgart 2012)
Sass & Compass (Barcamp Stuttgart 2012)Sass & Compass (Barcamp Stuttgart 2012)
Sass & Compass (Barcamp Stuttgart 2012)emrox
 

Similaire à SASS, Compass 1.1 (20)

Wrangling the CSS Beast with Sass
Wrangling the CSS Beast  with SassWrangling the CSS Beast  with Sass
Wrangling the CSS Beast with Sass
 
CSS Extenders
CSS ExtendersCSS Extenders
CSS Extenders
 
Brian Hoke: WordCamp Toronto 2014 Presentation "Sass & WordPress"
Brian Hoke: WordCamp Toronto 2014 Presentation "Sass & WordPress"Brian Hoke: WordCamp Toronto 2014 Presentation "Sass & WordPress"
Brian Hoke: WordCamp Toronto 2014 Presentation "Sass & WordPress"
 
A better CSS: Sass and Less - CC FE & UX
A better CSS: Sass and Less - CC FE & UXA better CSS: Sass and Less - CC FE & UX
A better CSS: Sass and Less - CC FE & UX
 
FCIP SASS Talk
FCIP SASS TalkFCIP SASS Talk
FCIP SASS Talk
 
Work and play with SASS & Compass
Work and play with SASS & CompassWork and play with SASS & Compass
Work and play with SASS & Compass
 
Finding your way with Sass+Compass
Finding your way with Sass+CompassFinding your way with Sass+Compass
Finding your way with Sass+Compass
 
Simple introduction Sass
Simple introduction SassSimple introduction Sass
Simple introduction Sass
 
PHP 5 Boot Camp
PHP 5 Boot CampPHP 5 Boot Camp
PHP 5 Boot Camp
 
Preprocessor presentation
Preprocessor presentationPreprocessor presentation
Preprocessor presentation
 
Theming and Sass
Theming and SassTheming and Sass
Theming and Sass
 
Sassy Stylesheets with SCSS
Sassy Stylesheets with SCSSSassy Stylesheets with SCSS
Sassy Stylesheets with SCSS
 
CSS with LESS for #jd13nl
CSS with LESS for #jd13nlCSS with LESS for #jd13nl
CSS with LESS for #jd13nl
 
Sass, Compass
Sass, CompassSass, Compass
Sass, Compass
 
Drupal & CSS Preprocessors
Drupal & CSS PreprocessorsDrupal & CSS Preprocessors
Drupal & CSS Preprocessors
 
Sass - Making CSS fun again.
Sass - Making CSS fun again.Sass - Making CSS fun again.
Sass - Making CSS fun again.
 
Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version)
Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version)Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version)
Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version)
 
Building Custom WordPress Themes with Sass - WordCamp Sacramento 2016
Building Custom WordPress Themes with Sass - WordCamp Sacramento 2016Building Custom WordPress Themes with Sass - WordCamp Sacramento 2016
Building Custom WordPress Themes with Sass - WordCamp Sacramento 2016
 
Sass
SassSass
Sass
 
Sass & Compass (Barcamp Stuttgart 2012)
Sass & Compass (Barcamp Stuttgart 2012)Sass & Compass (Barcamp Stuttgart 2012)
Sass & Compass (Barcamp Stuttgart 2012)
 

Dernier

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024The Digital Insurer
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 

Dernier (20)

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 

SASS, Compass 1.1

  • 3. DIE – Duplication is evil Friday, May 4, 12
  • 4. .round { -webkit-transform: scale(1); -moz-transform: scale(1); -o-transform: scale(1); transform: scale(1); } Friday, May 4, 12
  • 6. Windows http://rubyinstaller.org/downloads/ $ gem install haml $ gem install haml/edge Mac $ gem install haml $ gem install haml/edge Linux $ sudo apt-get install ruby $ gem install haml $ gem install haml/edge Установка Friday, May 4, 12
  • 7. $ sass --watch <folder> Cледит за изменениями в sass-файлах и компилирует их в css Как это работает Friday, May 4, 12
  • 8. $ sass --watch <folder> Cледит за изменениями в sass-файлах и компилирует их в css *.sass *.css Как это работает Friday, May 4, 12
  • 9. $ sass --watch <folder> Cледит за изменениями в sass-файлах и компилирует их в css *.sass *.css Как это работает Friday, May 4, 12
  • 11. table width: 100% tr td background: #edaeda p font-size: 14px SASS — Syntactically Awesome Stylesheets Friday, May 4, 12
  • 12. table{ width: 100%; tr{ td{ background: #edaeda; p{ font-size: 14px; } } } } SCSS — Sassy CSS Friday, May 4, 12
  • 14. SCSS — обратная совместимость Friday, May 4, 12
  • 16. .sidebar .sidebar { background: black background: black; h2 } font-size: 20px .sidebar h2 { a font-size: 20px color: blue } &:hover .sidebar a { text-decoration: none color: blue; } .sidebar a:hover { text-decoration: none; } Вложенность Friday, May 4, 12
  • 17. h2 h2{ font: font-style: italic; style: italic font-weight: bold; weight: bold font-size: 12px; size: 12px font-family: sans-serif; family: sans-serif } Вложенность Friday, May 4, 12
  • 19. $text-color: #edaeda $content-text: FUUUUUUUuuuuuu $headlines-font: Arial, Helvetica, sans-serif $true: false Переменные Friday, May 4, 12
  • 20. $width: 500px $height: 400px .center-absolute background: #f2c98a width: $width height: $height position: absolute left: 50% top: 50% margin-top: -($height/2) margin-left: -($width/2) Переменные Friday, May 4, 12
  • 21. $varclass: cahoona .big-#{$varclass} width: 2em Переменные Friday, May 4, 12
  • 23. @mixin font($size) font: $size Georgia, serif h1 +font(48px) p +font(14px) h1{ font: 48px Georgia, serif; } p{ font: 14px Georgia, serif; } Примеси Friday, May 4, 12
  • 25. $color: #f00 .somebox border: 1px solid $color box-shadow: 0 0 3px darken($color, 10%), inset 1px 0 lighten($color, 40%) .somebox { border: 1px solid red; box-shadow: 0 0 3px #cc0000, inset 1px 0 #ffcccc; } Функции Friday, May 4, 12
  • 26. .somebox background: rgba(#fff, 0.5) .somebox { background: rgba(255, 255, 255, 0.5); } Функции Friday, May 4, 12
  • 27. rgb($red, $green, $blue) lighten($color, $amount) rgba($red, $green, $blue, $alpha) darken($color, $amount) rgba($color, $alpha) saturate($color, $amount) red($color) desaturate($color, $amount) green($color) grayscale($color) blue($color) complement($color) mix($color-1, $color-2, [$weight]) invert($color) hsl($hue, $saturation, $lightness) alpha($color) / opacity($color) hsla($hue, $saturation, $lightness, $alpha) rgba($color, $alpha) hue($color) opacify($color, $amount) / fade-in($color, $amount) saturation($color) transparentize($color, $amount) / fade-out($color, $amount) lightness($color) adjust-hue($color, $degrees) Еще функции Friday, May 4, 12
  • 28. http://sass-lang.com/docs/yardoc/Sass/Script/Functions.html И еще функции Friday, May 4, 12
  • 30. .food background-image: url(food-sprite.png) .food-bacon @extend .food background-position: 0 -10px width: 25px height: 10px .food-pizza @extend .food background-position: 0 -20px width: 45px height: 35px @extend Friday, May 4, 12
  • 31. .food, .food-bacon, .food-pizza{ background-image: url(food-sprite.png); } .food-bacon{ background-position: 0 -10px; width: 25px; height: 10px; } .food-pizza{ background-position: 0 -20px; width: 45px; height: 35px; } @extend Friday, May 4, 12
  • 33. master.sass @import “main.sass” @import “index.sass” @import “profile.sass” master.css main.css + index.css + profile.css @import Friday, May 4, 12
  • 34. @if @for, @while @function @each Кроме того Friday, May 4, 12
  • 38. .round +border-radius(25px) CSS3 Friday, May 4, 12
  • 39. .round +border-radius(25px) .round { -webkit-border-radius: 25px; -moz-border-radius: 25px; -o-border-radius: 25px; -ms-border-radius: 25px; -khtml-border-radius: 25px; border-radius: 25px; } CSS3 Friday, May 4, 12
  • 40. .shadow   +box-shadow(0 0 4px #ccc) .shadow {   -moz-box-shadow: 0 0 4px #cccccc;   -webkit-box-shadow: 0 0 4px #cccccc;   -o-box-shadow: 0 0 4px #cccccc;   box-shadow: 0 0 4px #cccccc; } CSS3 Friday, May 4, 12
  • 41. .gradient   +background-image(linear-gradient(#fff, #ccc 30%, #bbb 70%, #aaa)) .gradient { background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #ffffff), color-stop(30%, #cccccc), color-stop(70%, #bbbbbb), color-stop(100%, #aaaaaa)); background-image: -webkit-linear-gradient(#ffffff, #cccccc 30%, #bbbbbb 70%, #aaaaaa); background-image: -moz-linear-gradient(#ffffff, #cccccc 30%, #bbbbbb 70%, #aaaaaa); background-image: -o-linear-gradient(#ffffff, #cccccc 30%, #bbbbbb 70%, #aaaaaa); background-image: -ms-linear-gradient(#ffffff, #cccccc 30%, #bbbbbb 70%, #aaaaaa); background-image: linear-gradient(#ffffff, #cccccc 30%, #bbbbbb 70%, #aaaaaa); } CSS3 Friday, May 4, 12
  • 42. .beauty-box +border-radius(25px) +box-shadow(0 0 4px #ccc) +background-image(linear-gradient(#fff, #aaa)) CSS3 Friday, May 4, 12
  • 43. .beauty-box { -webkit-border-radius: 25px; -moz-border-radius: 25px; -o-border-radius: 25px; -ms-border-radius: 25px; -khtml-border-radius: 25px; border-radius: 25px; -moz-box-shadow: 0 0 4px #cccccc; -webkit-box-shadow: 0 0 4px #cccccc; -o-box-shadow: 0 0 4px #cccccc; box-shadow: 0 0 4px #cccccc; background-image: -webkit-gradient(... color-stop(30%, #cccccc), color-stop(... background-image: -webkit-linear-gradient(... background-image: -moz-linear-gradient(... background-image: -o-linear-gradient(... background-image: -ms-linear-gradient(... background-image: linear-gradient(... } CSS3 Friday, May 4, 12
  • 44. Background Clip Background Origin Background Size Box Box Sizing Columns Clearfix Font Face Inline Block Opacity Transition Transform CSS3 Friday, May 4, 12
  • 46. ico/fb.png ico/vk.png ico/twi.png $sprite: sprite-map("ico/*.png") .fb background: sprite($sprite, fb) .vk background: sprite($sprite, vk) .twi background: sprite($sprite, twi) Спрайты Friday, May 4, 12
  • 47. ico/fb.png ico/vk.png ico/twi.png $sprite: sprite-map("ico/*.png") .fb background: sprite($sprite, fb) .vk background: sprite($sprite, vk) .twi background: sprite($sprite, twi) Спрайты Friday, May 4, 12
  • 48. ico/fb.png ico/vk.png ico/twi.png $sprite: sprite-map("ico/*.png") .fb background: sprite($sprite, fb) .vk background: sprite($sprite, vk) .twi background: sprite($sprite, twi) Спрайты Friday, May 4, 12
  • 49. ico/fb.png ico/vk.png ico/twi.png $sprite: sprite-map("ico/*.png") .fb background: sprite($sprite, fb) .vk background: sprite($sprite, vk) .twi background: sprite($sprite, twi) Спрайты Friday, May 4, 12
  • 50. ico-s2e5fe71d31.png .fb { background: url('images/ico-s2e5fe71d31.png') 0 0px no-repeat; } .vk { background: url('images/ico-s2e5fe71d31.png') 0 -41px no-repeat; } .twi { background: url('images/ico-s2e5fe71d31.png') 0 -82px no-repeat; } Спрайты Friday, May 4, 12
  • 51. ico-s2e5fe71d31.png .fb { background: url('images/ico-s2e5fe71d31.png') 0 0px no-repeat; } .vk { background: url('images/ico-s2e5fe71d31.png') 0 -41px no-repeat; } .twi { background: url('images/ico-s2e5fe71d31.png') 0 -82px no-repeat; } Спрайты Friday, May 4, 12
  • 52. ico-s2e5fe71d31.png .fb { background: url('images/ico-s2e5fe71d31.png') 0 0px no-repeat; } .vk { background: url('images/ico-s2e5fe71d31.png') 0 -41px no-repeat; } .twi { background: url('images/ico-s2e5fe71d31.png') 0 -82px no-repeat; } Спрайты Friday, May 4, 12
  • 53. .basebox background: inline-image("pic.png") .basebox { background: url('data:image/png;base64,1UcAAA...AASUVORK5CYII='); } Base64 Friday, May 4, 12
  • 54. # You can select your preferred output style here (can be overridden via the command line): # output_style = :expanded or :nested or :compact or :compressed output_style = :compressed Config.rb Friday, May 4, 12
  • 55. http://sass-lang.com/ http://compass-style.org/ http://chriseppstein.github.com/ http://nex-3.com/ http://thesassway.com/ Что почитать Friday, May 4, 12
  • 56. Спасибо Вопросы? @llazio sd@evilmartians.com www.evilmartians.ru Дыниовский Сергей Friday, May 4, 12