SlideShare uma empresa Scribd logo
1 de 16
Baixar para ler offline
Simplify your CSS
with Stylus and Nib
  Christian Joudrey - @cjoudrey
The current state of CSS

#comments li {
  background-color: #FEFEFE;
}

#comments .author {
  -webkit-border-radius: 5px;
  -moz-border-radius: 5px;
  border-radius: 5px;
}
Stylus




“Expressive, robust, feature-rich CSS language
built for nodejs”
Main differences
• Get rid of syntactic sugar (brackets, semi-colons, colons)

• Enforced indentation

• Don't repeat yourself (DRY)


body
  font 12px Helvetica, Arial, sans-serif

a.button
  -webkit-border-radius 5px
  -moz-border-radius 5px
  border-radius 5px
Variables
$font-size = 14px

body
  font $font-size Helvetica, Arial, sans-serif
Mixins

body
  font 12px Helvetica, Arial, sans-serif

border-radius()
  -webkit-border-radius arguments
  -moz-border-radius arguments
  border-radius arguments

a.button
  border-radius 5px
Nested selectors

#comments                   #comments h1 {
  h1                          font-size: 14px;
     font-size 14px         }
  a
     color black            #comments a {
                              color: black;
    &:hover                 }
      color blue
                            #comments a:hover {
                              color: blue;
                            }
Nib




“Stylus mixins, utilities, components, and
gradient image generation. CSS is your bitch!”
Vendor prefixes
@import 'nib'                #comments {
                               -webkit-border-radius: 4px;
                               -moz-border-radius: 4px;
#comments                      border-radius: 4px;
  border-radius 4px            -webkit-box-shadow: 0 0 1px #000;
                               -moz-box-shadow: 0 0 1px #000;
  box-shadow 0 0 1px black     box-shadow: 0 0 1px #000;
  p                          }
    opacity 0.75
                             #comments p {
                               opacity: 0.75;
                               filter: progid:DXIm[...]pha(Opacity=75);
                             }
Clearfix
@import 'nib'         .cf {
                        zoom: 1;
.cf                   }
  clearfix()          .cf:before,
                      .cf:after {
                        content: "";
                        display: table;
                      }
                      .cf:after {
                        clear: both;
                      }
Hide-text
@import 'nib'          #slogan {
                          text-indent: -99999em;
#slogan                   overflow: hidden;
  hide-text()             text-align: left;
                       }
and a lot more...
The best part is...
• It's all optional, you can mix and match Stylus and CSS

• Slowly integrate it in your existing CSS


                @import 'nib'

                #comments {
                  border-radius: 4px;
                  border: 1px solid black;
                }
Express Middleware
var express = require('express'),
    stylus = require('stylus'),
    nib = require('nib'),
    app = express.createServer();

// ...

app.use(stylus.middleware({
  src: __dirname + '/public',
  compile: function (str, path){
     return stylus(str)
       .set('filename', path)
       .set('compress', true)
       .use(nib());
  }
}));
Command-line Tool

$ npm install -g stylus


$ stylus main.styl
   compiled main.css


$ stylus -u nib main.styl
   compiled main.css
Interesting Links

• Stylus: http://learnboost.github.com/stylus

• Nib: https://github.com/visionmedia/nib

Mais conteúdo relacionado

Destaque

New Product Development Report
New Product Development ReportNew Product Development Report
New Product Development ReportGlen Chan
 
37 Ways for New Product Ideas
37 Ways for New Product Ideas37 Ways for New Product Ideas
37 Ways for New Product IdeasMarc Heleven
 
Report on launching of new product
Report on launching of new productReport on launching of new product
Report on launching of new productFaiza Javaid
 
A 30-minute Introduction to NETCONF and YANG
A 30-minute Introduction to NETCONF and YANGA 30-minute Introduction to NETCONF and YANG
A 30-minute Introduction to NETCONF and YANGTail-f Systems
 
Ballast Water Treatment with VOS™ | N.E.I. Treatment Systems
Ballast Water Treatment with VOS™  | N.E.I. Treatment SystemsBallast Water Treatment with VOS™  | N.E.I. Treatment Systems
Ballast Water Treatment with VOS™ | N.E.I. Treatment SystemsNEI Marine
 
My Communication Lab
My Communication LabMy Communication Lab
My Communication LabCorey Durward
 
KABLOSUZ PROB YARDIMIYLA GEOPHONE SİSTEMİ TASARIMI
KABLOSUZ PROB YARDIMIYLA GEOPHONE SİSTEMİ TASARIMIKABLOSUZ PROB YARDIMIYLA GEOPHONE SİSTEMİ TASARIMI
KABLOSUZ PROB YARDIMIYLA GEOPHONE SİSTEMİ TASARIMIMutugu Gultepe
 
Qu’est-ce que la carte MasterCard prépayée paysafecard?
Qu’est-ce que la carte MasterCard prépayée paysafecard?Qu’est-ce que la carte MasterCard prépayée paysafecard?
Qu’est-ce que la carte MasterCard prépayée paysafecard?paysafecard6curtis57
 
Lotus Notes Migration
Lotus Notes MigrationLotus Notes Migration
Lotus Notes MigrationRam Prabhalla
 
Netezza vs teradata
Netezza vs teradataNetezza vs teradata
Netezza vs teradataAsis Mohanty
 
Immunohistochemistry (IHC)Staining Steps
Immunohistochemistry (IHC)Staining StepsImmunohistochemistry (IHC)Staining Steps
Immunohistochemistry (IHC)Staining StepsLawrence Richards
 
MicroStrategy Design Challenges - Tips and Best Practices
MicroStrategy Design Challenges - Tips and Best PracticesMicroStrategy Design Challenges - Tips and Best Practices
MicroStrategy Design Challenges - Tips and Best PracticesBiBoard.Org
 
OOW15 - Testing Oracle E-Business Suite Best Practices
OOW15 - Testing Oracle E-Business Suite Best PracticesOOW15 - Testing Oracle E-Business Suite Best Practices
OOW15 - Testing Oracle E-Business Suite Best Practicesvasuballa
 
Speech Lessons 1-7
Speech Lessons 1-7Speech Lessons 1-7
Speech Lessons 1-7Monica P
 
Processed Meat Packaging - Anas Shaikh - 13FET1006
Processed Meat Packaging - Anas Shaikh - 13FET1006Processed Meat Packaging - Anas Shaikh - 13FET1006
Processed Meat Packaging - Anas Shaikh - 13FET1006Anas Ejaz Yasmeen Shaikh
 
key word indexing and their types with example
key word indexing and their types with example key word indexing and their types with example
key word indexing and their types with example Sourav Sarkar
 
Operational Transformation in Banking Operations
Operational Transformation in Banking OperationsOperational Transformation in Banking Operations
Operational Transformation in Banking OperationsRajeev De Roy
 

Destaque (20)

New Product Development Report
New Product Development ReportNew Product Development Report
New Product Development Report
 
NETCONF YANG tutorial
NETCONF YANG tutorialNETCONF YANG tutorial
NETCONF YANG tutorial
 
37 Ways for New Product Ideas
37 Ways for New Product Ideas37 Ways for New Product Ideas
37 Ways for New Product Ideas
 
Report on launching of new product
Report on launching of new productReport on launching of new product
Report on launching of new product
 
A 30-minute Introduction to NETCONF and YANG
A 30-minute Introduction to NETCONF and YANGA 30-minute Introduction to NETCONF and YANG
A 30-minute Introduction to NETCONF and YANG
 
Ballast Water Treatment with VOS™ | N.E.I. Treatment Systems
Ballast Water Treatment with VOS™  | N.E.I. Treatment SystemsBallast Water Treatment with VOS™  | N.E.I. Treatment Systems
Ballast Water Treatment with VOS™ | N.E.I. Treatment Systems
 
My Communication Lab
My Communication LabMy Communication Lab
My Communication Lab
 
KABLOSUZ PROB YARDIMIYLA GEOPHONE SİSTEMİ TASARIMI
KABLOSUZ PROB YARDIMIYLA GEOPHONE SİSTEMİ TASARIMIKABLOSUZ PROB YARDIMIYLA GEOPHONE SİSTEMİ TASARIMI
KABLOSUZ PROB YARDIMIYLA GEOPHONE SİSTEMİ TASARIMI
 
Qu’est-ce que la carte MasterCard prépayée paysafecard?
Qu’est-ce que la carte MasterCard prépayée paysafecard?Qu’est-ce que la carte MasterCard prépayée paysafecard?
Qu’est-ce que la carte MasterCard prépayée paysafecard?
 
Lotus Notes Migration
Lotus Notes MigrationLotus Notes Migration
Lotus Notes Migration
 
Tc basics
Tc basicsTc basics
Tc basics
 
Netezza vs teradata
Netezza vs teradataNetezza vs teradata
Netezza vs teradata
 
Immunohistochemistry (IHC)Staining Steps
Immunohistochemistry (IHC)Staining StepsImmunohistochemistry (IHC)Staining Steps
Immunohistochemistry (IHC)Staining Steps
 
MicroStrategy Design Challenges - Tips and Best Practices
MicroStrategy Design Challenges - Tips and Best PracticesMicroStrategy Design Challenges - Tips and Best Practices
MicroStrategy Design Challenges - Tips and Best Practices
 
OOW15 - Testing Oracle E-Business Suite Best Practices
OOW15 - Testing Oracle E-Business Suite Best PracticesOOW15 - Testing Oracle E-Business Suite Best Practices
OOW15 - Testing Oracle E-Business Suite Best Practices
 
Speech Lessons 1-7
Speech Lessons 1-7Speech Lessons 1-7
Speech Lessons 1-7
 
Processed Meat Packaging - Anas Shaikh - 13FET1006
Processed Meat Packaging - Anas Shaikh - 13FET1006Processed Meat Packaging - Anas Shaikh - 13FET1006
Processed Meat Packaging - Anas Shaikh - 13FET1006
 
key word indexing and their types with example
key word indexing and their types with example key word indexing and their types with example
key word indexing and their types with example
 
31-P NMR SPECTROSCOPY
31-P NMR SPECTROSCOPY31-P NMR SPECTROSCOPY
31-P NMR SPECTROSCOPY
 
Operational Transformation in Banking Operations
Operational Transformation in Banking OperationsOperational Transformation in Banking Operations
Operational Transformation in Banking Operations
 

Semelhante a Simplify your CSS with Stylus and Nib

Mobile-first OOCSS, Sass & Compass at BBC Responsive News
Mobile-first OOCSS, Sass & Compass at BBC Responsive NewsMobile-first OOCSS, Sass & Compass at BBC Responsive News
Mobile-first OOCSS, Sass & Compass at BBC Responsive NewsKaelig Deloumeau-Prigent
 
Write LESS. DO more.
Write LESS. DO more.Write LESS. DO more.
Write LESS. DO more.Eugene Nor
 
Preprocessor presentation
Preprocessor presentationPreprocessor presentation
Preprocessor presentationMario Noble
 
Big Design Conference: CSS3
Big Design Conference: CSS3 Big Design Conference: CSS3
Big Design Conference: CSS3 Wynn Netherland
 
Rapid Prototyping
Rapid PrototypingRapid Prototyping
Rapid PrototypingEven Wu
 
Sass and Compass - Getting Started
Sass and Compass - Getting StartedSass and Compass - Getting Started
Sass and Compass - Getting Startededgincvg
 
Finding your way with Sass+Compass
Finding your way with Sass+CompassFinding your way with Sass+Compass
Finding your way with Sass+Compassdrywallbmb
 
Simplifying CSS With Sass
Simplifying CSS With SassSimplifying CSS With Sass
Simplifying CSS With SassThomas Reynolds
 
Messy css
Messy cssMessy css
Messy cssxavijam
 
Learn to love CSS3 | Joomla! Day Deutschland
Learn to love CSS3 | Joomla! Day DeutschlandLearn to love CSS3 | Joomla! Day Deutschland
Learn to love CSS3 | Joomla! Day DeutschlandThemePartner
 
Learn to Love CSS3 [English]
Learn to Love CSS3 [English]Learn to Love CSS3 [English]
Learn to Love CSS3 [English]ThemePartner
 
CSS3 is Not Magic Pixie Dust
CSS3 is Not Magic Pixie DustCSS3 is Not Magic Pixie Dust
CSS3 is Not Magic Pixie DustKyle Adams
 
Doing More With Less
Doing More With LessDoing More With Less
Doing More With LessDavid Engel
 
Compass, Sass, and the Enlightened CSS Developer
Compass, Sass, and the Enlightened CSS DeveloperCompass, Sass, and the Enlightened CSS Developer
Compass, Sass, and the Enlightened CSS DeveloperWynn Netherland
 
Compass And Sass(Tim Riley)
Compass And Sass(Tim Riley)Compass And Sass(Tim Riley)
Compass And Sass(Tim Riley)elliando dias
 
Oocss & progressive css3 selectors
Oocss & progressive css3 selectorsOocss & progressive css3 selectors
Oocss & progressive css3 selectorsdaniel_sternlicht
 
Sass & Compass (Barcamp Stuttgart 2012)
Sass & Compass (Barcamp Stuttgart 2012)Sass & Compass (Barcamp Stuttgart 2012)
Sass & Compass (Barcamp Stuttgart 2012)emrox
 

Semelhante a Simplify your CSS with Stylus and Nib (20)

Accelerated Stylesheets
Accelerated StylesheetsAccelerated Stylesheets
Accelerated Stylesheets
 
Sass compass
Sass compassSass compass
Sass compass
 
Mobile-first OOCSS, Sass & Compass at BBC Responsive News
Mobile-first OOCSS, Sass & Compass at BBC Responsive NewsMobile-first OOCSS, Sass & Compass at BBC Responsive News
Mobile-first OOCSS, Sass & Compass at BBC Responsive News
 
Write LESS. DO more.
Write LESS. DO more.Write LESS. DO more.
Write LESS. DO more.
 
Preprocessor presentation
Preprocessor presentationPreprocessor presentation
Preprocessor presentation
 
Less & Sass
Less & SassLess & Sass
Less & Sass
 
Big Design Conference: CSS3
Big Design Conference: CSS3 Big Design Conference: CSS3
Big Design Conference: CSS3
 
Rapid Prototyping
Rapid PrototypingRapid Prototyping
Rapid Prototyping
 
Sass and Compass - Getting Started
Sass and Compass - Getting StartedSass and Compass - Getting Started
Sass and Compass - Getting Started
 
Finding your way with Sass+Compass
Finding your way with Sass+CompassFinding your way with Sass+Compass
Finding your way with Sass+Compass
 
Simplifying CSS With Sass
Simplifying CSS With SassSimplifying CSS With Sass
Simplifying CSS With Sass
 
Messy css
Messy cssMessy css
Messy css
 
Learn to love CSS3 | Joomla! Day Deutschland
Learn to love CSS3 | Joomla! Day DeutschlandLearn to love CSS3 | Joomla! Day Deutschland
Learn to love CSS3 | Joomla! Day Deutschland
 
Learn to Love CSS3 [English]
Learn to Love CSS3 [English]Learn to Love CSS3 [English]
Learn to Love CSS3 [English]
 
CSS3 is Not Magic Pixie Dust
CSS3 is Not Magic Pixie DustCSS3 is Not Magic Pixie Dust
CSS3 is Not Magic Pixie Dust
 
Doing More With Less
Doing More With LessDoing More With Less
Doing More With Less
 
Compass, Sass, and the Enlightened CSS Developer
Compass, Sass, and the Enlightened CSS DeveloperCompass, Sass, and the Enlightened CSS Developer
Compass, Sass, and the Enlightened CSS Developer
 
Compass And Sass(Tim Riley)
Compass And Sass(Tim Riley)Compass And Sass(Tim Riley)
Compass And Sass(Tim Riley)
 
Oocss & progressive css3 selectors
Oocss & progressive css3 selectorsOocss & progressive css3 selectors
Oocss & progressive css3 selectors
 
Sass & Compass (Barcamp Stuttgart 2012)
Sass & Compass (Barcamp Stuttgart 2012)Sass & Compass (Barcamp Stuttgart 2012)
Sass & Compass (Barcamp Stuttgart 2012)
 

Último

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
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
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
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
 

Último (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
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...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
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
 

Simplify your CSS with Stylus and Nib

  • 1. Simplify your CSS with Stylus and Nib Christian Joudrey - @cjoudrey
  • 2. The current state of CSS #comments li { background-color: #FEFEFE; } #comments .author { -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; }
  • 3. Stylus “Expressive, robust, feature-rich CSS language built for nodejs”
  • 4. Main differences • Get rid of syntactic sugar (brackets, semi-colons, colons) • Enforced indentation • Don't repeat yourself (DRY) body font 12px Helvetica, Arial, sans-serif a.button -webkit-border-radius 5px -moz-border-radius 5px border-radius 5px
  • 5. Variables $font-size = 14px body font $font-size Helvetica, Arial, sans-serif
  • 6. Mixins body font 12px Helvetica, Arial, sans-serif border-radius() -webkit-border-radius arguments -moz-border-radius arguments border-radius arguments a.button border-radius 5px
  • 7. Nested selectors #comments #comments h1 { h1 font-size: 14px; font-size 14px } a color black #comments a { color: black; &:hover } color blue #comments a:hover { color: blue; }
  • 8. Nib “Stylus mixins, utilities, components, and gradient image generation. CSS is your bitch!”
  • 9. Vendor prefixes @import 'nib' #comments { -webkit-border-radius: 4px; -moz-border-radius: 4px; #comments border-radius: 4px; border-radius 4px -webkit-box-shadow: 0 0 1px #000; -moz-box-shadow: 0 0 1px #000; box-shadow 0 0 1px black box-shadow: 0 0 1px #000; p } opacity 0.75 #comments p { opacity: 0.75; filter: progid:DXIm[...]pha(Opacity=75); }
  • 10. Clearfix @import 'nib' .cf { zoom: 1; .cf } clearfix() .cf:before, .cf:after { content: ""; display: table; } .cf:after { clear: both; }
  • 11. Hide-text @import 'nib' #slogan { text-indent: -99999em; #slogan overflow: hidden; hide-text() text-align: left; }
  • 12. and a lot more...
  • 13. The best part is... • It's all optional, you can mix and match Stylus and CSS • Slowly integrate it in your existing CSS @import 'nib' #comments { border-radius: 4px; border: 1px solid black; }
  • 14. Express Middleware var express = require('express'), stylus = require('stylus'), nib = require('nib'), app = express.createServer(); // ... app.use(stylus.middleware({ src: __dirname + '/public', compile: function (str, path){ return stylus(str) .set('filename', path) .set('compress', true) .use(nib()); } }));
  • 15. Command-line Tool $ npm install -g stylus $ stylus main.styl compiled main.css $ stylus -u nib main.styl compiled main.css
  • 16. Interesting Links • Stylus: http://learnboost.github.com/stylus • Nib: https://github.com/visionmedia/nib