SlideShare a Scribd company logo
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

More Related Content

Viewers also liked

New Product Development Report
New Product Development ReportNew Product Development Report
New Product Development Report
Glen Chan
 
NETCONF YANG tutorial
NETCONF YANG tutorialNETCONF YANG tutorial
NETCONF YANG tutorial
Tail-f Systems
 
37 Ways for New Product Ideas
37 Ways for New Product Ideas37 Ways for New Product Ideas
37 Ways for New Product Ideas
Marc 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 YANG
Tail-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 Systems
NEI 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İ TASARIMI
Mutugu 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 Migration
Ram Prabhalla
 
Tc basics
Tc basicsTc basics
Tc basics
jeromy fu
 
Netezza vs teradata
Netezza vs teradataNetezza vs teradata
Netezza vs teradata
Asis Mohanty
 
Immunohistochemistry (IHC)Staining Steps
Immunohistochemistry (IHC)Staining StepsImmunohistochemistry (IHC)Staining Steps
Immunohistochemistry (IHC)Staining Steps
Lawrence 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 Practices
BiBoard.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 Practices
vasuballa
 
Speech Lessons 1-7
Speech Lessons 1-7Speech Lessons 1-7
Speech Lessons 1-7
Monica P
 
Processed Meat Packaging - Anas Shaikh - 13FET1006
Processed Meat Packaging - Anas Shaikh - 13FET1006Processed Meat Packaging - Anas Shaikh - 13FET1006
Processed Meat Packaging - Anas Shaikh - 13FET1006
Anas 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
 
31-P NMR SPECTROSCOPY
31-P NMR SPECTROSCOPY31-P NMR SPECTROSCOPY
31-P NMR SPECTROSCOPY
AIOU, ISLAMABAD
 
Operational Transformation in Banking Operations
Operational Transformation in Banking OperationsOperational Transformation in Banking Operations
Operational Transformation in Banking OperationsRajeev De Roy
 

Viewers also liked (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
 

Similar to 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 presentation
Mario Noble
 
Less & Sass
Less & SassLess & Sass
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+Compass
drywallbmb
 
Simplifying CSS With Sass
Simplifying CSS With SassSimplifying CSS With Sass
Simplifying CSS With Sass
Thomas Reynolds
 
Messy css
Messy cssMessy css
Messy css
xavijam
 
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
ThemePartner
 
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 Dust
Kyle Adams
 
Doing More With Less
Doing More With LessDoing More With Less
Doing More With Less
David 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 Developer
Wynn 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 selectors
daniel_sternlicht
 
Sass & Compass (Barcamp Stuttgart 2012)
Sass & Compass (Barcamp Stuttgart 2012)Sass & Compass (Barcamp Stuttgart 2012)
Sass & Compass (Barcamp Stuttgart 2012)
emrox
 

Similar to 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)
 

Recently uploaded

UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
James Anderson
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
nkrafacyberclub
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 

Recently uploaded (20)

UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 

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