SlideShare ist ein Scribd-Unternehmen logo
1 von 40
Getting Started with PostCSS
When you are too lazy or too smart
By: Neha Sharma | @hellonehha | nehha255@gmail.com
AGENDA
- Introduction to PostCSS
- Popularity of PostCSS
- API of PostCSS
- Advantages of PostCSS
- How to Use PostCSS with Grunt, Gulp, Webpack
- Explore PostCSS Plugins
- Who is using PostCSS
- What is PostCSS is NOT
- Where to use PostCSS
WHAT IS POSTCSS?
PostCSS is developed by Andrey Sitnik, creator of Autoprefixer, it was launched as a method to use
JavaScript for CSS processing. It is a way of reinventing the css with an ecosystem of custom
plugins and tools. It extends the features, syntaxes and enhance the css into browser friendly css.
PostCSS on its own is simply an API, which, when used with its vast ecosystem of plugins, offers
powerful abilities. It uses the Nodejs Framework - the abilities of the language and tools can be easily
modified and customized as needed. PostCSS is agnostic to language format and allows the syntax of
different preprocessors such as less, SASS etc
Postcss has been growing in popularity.In 2014 there were a little under 1.4 million downloads in total for
the year, but from in 2015 there had already been 9.3 million downloads. Source
As per the PostCSS github Page:
“PostCSS is a tool for transforming CSS with JS plugins. These plugins can support variables
and mixins, transpile future CSS syntax, inline images, and more.”
PostCSS uses Nodejs framework that parse the CSS into the Abstract Syntax tree. Passes that AST through any number
of plugin functions and then converts that AST backs into a string which can output to a file.
1) css.eachRule() // to cycle through each rule set in a file
2) rule.eachDecl() // to cycle through each declaration
3) rule.selector() // to get the selector of a rule
4) atRule.name() // name of an at-rule
These APIs make much easier for developer understand how and where the is being transformed and makes easy to work
with CSS and to creates its own plugin.It modifies comments, declatation, rules, etc.
In a nutshell, PostCSS is more than a pre-processor and it is not Post-processor.
PostCSS is a wrapper for lot of things (plugins) to make your css workflow easy and fast. It is a tool for transforming your
CSS to JS Plugin
PostCSS itself do not parse your css.You need to install itsplugins and based on its requirement plugins will or will not parse
your CSS to give you the desire output. It parse your css into the nodes, you can access every node and do the operation
as required.
Advantages of PostCSS
PERFORMANCE
““““
TAKES YOU IN
FUTURE
TAKE CARE OF
OLD
BROWSERS
CREATE YOUR
PLUGINS
USE WITH
REGULAR CSS
EASILY
DEPLOY WITH
OTHER TOOLS
MODULAR CSS
LOTS OF
PLUGINS
AUTOMATE
YOUR CSS
3X FASTER
WRITE SASS
WITHOUT
SASS
HOW TO USE?
PostCSS can be installed with gulp, Grunt, webpack, Broccoli and by CLI too.
It is very easy to install and use with other tools. In 2 simple steps we can start using the PostCSS:
1- Find and add PostCSS extensions for your build tool.
2- Select plugins and add them to your PostCSS process.
Currently, PostCSS has more than 200 plugins. You can find all of the plugins in the plugins list or in the searchable
catalog.
Grunt
EXPLORE
We will be exploring few most popular plugins of postcss with the grunt build tool
- Images and Fonts
- Grids
- Optimizations
- Shortcuts
- Others
PostCSS have lot of plugins related to one can think of and can use any to enhance your work. Do check
all the details at
- Packs
- Future CSS Syntax
- Fallbacks
- Language Extensions
- Colors
- Analysis
- Reporters
- Fun
Install Grunt & PostCSS
1- Download nodejs
2- Create your project folder
3- Run command < npm install init >
4- Follow the commands to create package.json
5- Create gruntfile.js to load the package.json
6- Run the command to install PostCSS <npm install grunt-postcss --save-dev >
7- Load the package in gruntfile.js refer to slide 17-18
7- Congratulations your Postcss is installed
auto-prefixer
Autoprefixer lets you write normal css and makes you forget about prefix as it will handle it by itself. Autoprefix will parse
your css and add vendor prefixes to css rule using values from http://caniuse.com/ .It is highly recommended and used by
Google, twitter.
You can try the interactive demo too. http://autoprefixer.github.io/
Features:
- Remove outdated prefixes
- Browser support
- Actual prefix
- Pure css
- Support SASS, LESS and Stylus too
$npm install grunt-postcss autoprefixer
When to use?
- When you are too lazy to take care of support of css property on each browser
- When you are too smart to leave it on the plugin to take care when to add prefix and when to not
- When you want your project to follow the latest support
cssnano
CSSnano is built on the top of the POSTCss ecosystem.It is more than just a simple optimization tool. It do advance level of
optimization by taking your beautiful written css into high level optimized and clean output. http://cssnano.co/
Features:
- Vendor aware rule merging
- Pseudo element double-colon syntax reduction
- Optimize the z-index value
- Remove the outdated pre-fixes
- Remove the unused selectors
- Convert the font-weight to value
- optimize the font-family name
- Conversion of length, time & color values
precss
PreCSS is a tool that let you write your normal css in SASS way. You can enjoy writing Variables, mixins, extends and more
sass like syntaxes in your normal CSS.
Features:
- Let you write SASS like syntax in normal CSS
- Let you add Variables
- Let you add mixins
- Let you add extends
- and much more
CSSnext
cssnext is a css transpiler that allows you to use the latest CSS syntax today. It transforms new CSS specs into more
compatible CSS so you don’t need to wait for browser support.A lot of work has been made by the W3C to write new specs
to make our life easier which will be coming soon. CSSNext , let us use these new features today itself.
Check - http://cssnext.io/
Features:
- Custom Variables and properties
- Custom media queries
- Custom selectors
- filters
- not pseudo-class
- gray support()
- automatic prefix support
- and many more
You can try the interactive demo http://cssnext.io/playground/
Who is using PostCSS?
Google, Shopify, Twitter Bootstrap, codepen,
alibaba, and wordpress are few of the names
which are using the PostCSS plugins.
Codepen.io recently started the support of the
PostCSS plugin.
What PostCSS is not?
- It is not post processor
- It is not pre-processor
- It is not build suit
- It won’t replace Grunt/Gulp
- It is not something for fallbacks
- It is not Future css syntax
- It is not for optimization and clean CSS
Where to use PostCSS
- Everywhere
- When you want to write CSS as SASS without using sass
- When you want to do more by just one plugin
- When you want to write Modular CSS not SCSS
- When you are CSS Developer who wants to code smarter
- When you are too lazy for lots of tasks
- When you want to take your css work to next level
- When you are ready to explore , experiment and enhance yourself
Further Reads:
https://github.com/postcss/postcss
https://twitter.com/PostCSS
Reference
- Smashing Magazine
- Webdesign tutsplus
- Google
- https://github.com/postcss/postcss
- and plugins websites
Thankyou!

Weitere ähnliche Inhalte

Was ist angesagt?

WebAssembly in Houdini CSS, is it possible?
WebAssembly in Houdini CSS, is it possible?WebAssembly in Houdini CSS, is it possible?
WebAssembly in Houdini CSS, is it possible?Alexandr Skachkov
 
Azure Web PubSub Serviceを触ってみた
Azure Web PubSub Serviceを触ってみたAzure Web PubSub Serviceを触ってみた
Azure Web PubSub Serviceを触ってみたDevTakas
 
Webpack and Web Performance Optimization
Webpack and Web Performance OptimizationWebpack and Web Performance Optimization
Webpack and Web Performance OptimizationChen-Tien Tsai
 
Bundling your front-end with Webpack
Bundling your front-end with WebpackBundling your front-end with Webpack
Bundling your front-end with WebpackDanillo Corvalan
 
WebAssembly vs JavaScript: What is faster?
WebAssembly vs JavaScript: What is faster?WebAssembly vs JavaScript: What is faster?
WebAssembly vs JavaScript: What is faster?Alexandr Skachkov
 
Automation: PowerShell & DSC
Automation: PowerShell & DSCAutomation: PowerShell & DSC
Automation: PowerShell & DSCJosh Gillespie
 
Introduction to Vue.js DevStaff Meetup 13.02
Introduction to Vue.js  DevStaff Meetup 13.02Introduction to Vue.js  DevStaff Meetup 13.02
Introduction to Vue.js DevStaff Meetup 13.02Paul Bele
 
Aws amity university_presentation_oct-31-2020
Aws amity university_presentation_oct-31-2020Aws amity university_presentation_oct-31-2020
Aws amity university_presentation_oct-31-2020Varun Manik
 
Nodejs - Building a RESTful API
Nodejs - Building a RESTful APINodejs - Building a RESTful API
Nodejs - Building a RESTful APISang Cù
 
Don't let FaaS do a BaaS job
Don't let FaaS do a BaaS jobDon't let FaaS do a BaaS job
Don't let FaaS do a BaaS jobTessa Mero
 
WordCamp Seoul 2012
WordCamp Seoul 2012WordCamp Seoul 2012
WordCamp Seoul 2012Naoko Takano
 
Multisite core concepts final
Multisite core concepts finalMultisite core concepts final
Multisite core concepts finalUmesh Chaudhary
 
Leveraging the Power of Custom Elements in Gutenberg
Leveraging the Power of Custom Elements in GutenbergLeveraging the Power of Custom Elements in Gutenberg
Leveraging the Power of Custom Elements in GutenbergFelix Arntz
 
Azure Bootcamp Louisville - Node js presentation
Azure Bootcamp Louisville - Node js presentationAzure Bootcamp Louisville - Node js presentation
Azure Bootcamp Louisville - Node js presentationAndrea Walker
 

Was ist angesagt? (16)

WebAssembly in Houdini CSS, is it possible?
WebAssembly in Houdini CSS, is it possible?WebAssembly in Houdini CSS, is it possible?
WebAssembly in Houdini CSS, is it possible?
 
Azure Web PubSub Serviceを触ってみた
Azure Web PubSub Serviceを触ってみたAzure Web PubSub Serviceを触ってみた
Azure Web PubSub Serviceを触ってみた
 
Webpack and Web Performance Optimization
Webpack and Web Performance OptimizationWebpack and Web Performance Optimization
Webpack and Web Performance Optimization
 
Bundling your front-end with Webpack
Bundling your front-end with WebpackBundling your front-end with Webpack
Bundling your front-end with Webpack
 
WebAssembly vs JavaScript: What is faster?
WebAssembly vs JavaScript: What is faster?WebAssembly vs JavaScript: What is faster?
WebAssembly vs JavaScript: What is faster?
 
Automation: PowerShell & DSC
Automation: PowerShell & DSCAutomation: PowerShell & DSC
Automation: PowerShell & DSC
 
Introduction to Vue.js DevStaff Meetup 13.02
Introduction to Vue.js  DevStaff Meetup 13.02Introduction to Vue.js  DevStaff Meetup 13.02
Introduction to Vue.js DevStaff Meetup 13.02
 
Aws amity university_presentation_oct-31-2020
Aws amity university_presentation_oct-31-2020Aws amity university_presentation_oct-31-2020
Aws amity university_presentation_oct-31-2020
 
SQL_HA_DR_Azure
SQL_HA_DR_AzureSQL_HA_DR_Azure
SQL_HA_DR_Azure
 
Nodejs - Building a RESTful API
Nodejs - Building a RESTful APINodejs - Building a RESTful API
Nodejs - Building a RESTful API
 
Don't let FaaS do a BaaS job
Don't let FaaS do a BaaS jobDon't let FaaS do a BaaS job
Don't let FaaS do a BaaS job
 
WordCamp Seoul 2012
WordCamp Seoul 2012WordCamp Seoul 2012
WordCamp Seoul 2012
 
Multisite core concepts final
Multisite core concepts finalMultisite core concepts final
Multisite core concepts final
 
Leveraging the Power of Custom Elements in Gutenberg
Leveraging the Power of Custom Elements in GutenbergLeveraging the Power of Custom Elements in Gutenberg
Leveraging the Power of Custom Elements in Gutenberg
 
Azure Bootcamp Louisville - Node js presentation
Azure Bootcamp Louisville - Node js presentationAzure Bootcamp Louisville - Node js presentation
Azure Bootcamp Louisville - Node js presentation
 
Gameaways
GameawaysGameaways
Gameaways
 

Andere mochten auch

Responsive Web design
Responsive Web designResponsive Web design
Responsive Web designNeha Sharma
 
Introduction to Webcomponents
Introduction to WebcomponentsIntroduction to Webcomponents
Introduction to WebcomponentsNeha Sharma
 
面向未来的友好设计
面向未来的友好设计面向未来的友好设计
面向未来的友好设计Benny Chak
 
CSS3 Flex Layout
CSS3 Flex LayoutCSS3 Flex Layout
CSS3 Flex LayoutNeha Sharma
 
SASS - Syntactically Awesome Stylesheet
SASS - Syntactically Awesome StylesheetSASS - Syntactically Awesome Stylesheet
SASS - Syntactically Awesome StylesheetNeha Sharma
 
Turku &lt;3 Frontend - Progressive Web Apps, Web and Apps
Turku &lt;3 Frontend - Progressive Web Apps, Web and AppsTurku &lt;3 Frontend - Progressive Web Apps, Web and Apps
Turku &lt;3 Frontend - Progressive Web Apps, Web and AppsJoni Juup
 
Progressive web apps
 Progressive web apps Progressive web apps
Progressive web appsNeha Sharma
 
High Performance Web Pages - 20 new best practices
High Performance Web Pages - 20 new best practicesHigh Performance Web Pages - 20 new best practices
High Performance Web Pages - 20 new best practicesStoyan Stefanov
 
Content-first UX Design: What video games teach us about UX
Content-first UX Design: What video games teach us about UXContent-first UX Design: What video games teach us about UX
Content-first UX Design: What video games teach us about UXSteph Hay
 
Introduction to CSS
Introduction to CSSIntroduction to CSS
Introduction to CSSAmit Tyagi
 

Andere mochten auch (11)

Responsive Web design
Responsive Web designResponsive Web design
Responsive Web design
 
Introduction to Webcomponents
Introduction to WebcomponentsIntroduction to Webcomponents
Introduction to Webcomponents
 
面向未来的友好设计
面向未来的友好设计面向未来的友好设计
面向未来的友好设计
 
CSS3 Flex Layout
CSS3 Flex LayoutCSS3 Flex Layout
CSS3 Flex Layout
 
SASS - Syntactically Awesome Stylesheet
SASS - Syntactically Awesome StylesheetSASS - Syntactically Awesome Stylesheet
SASS - Syntactically Awesome Stylesheet
 
Turku &lt;3 Frontend - Progressive Web Apps, Web and Apps
Turku &lt;3 Frontend - Progressive Web Apps, Web and AppsTurku &lt;3 Frontend - Progressive Web Apps, Web and Apps
Turku &lt;3 Frontend - Progressive Web Apps, Web and Apps
 
Progressive web apps
 Progressive web apps Progressive web apps
Progressive web apps
 
High Performance Web Pages - 20 new best practices
High Performance Web Pages - 20 new best practicesHigh Performance Web Pages - 20 new best practices
High Performance Web Pages - 20 new best practices
 
Reactjs
Reactjs Reactjs
Reactjs
 
Content-first UX Design: What video games teach us about UX
Content-first UX Design: What video games teach us about UXContent-first UX Design: What video games teach us about UX
Content-first UX Design: What video games teach us about UX
 
Introduction to CSS
Introduction to CSSIntroduction to CSS
Introduction to CSS
 

Ähnlich wie Post css - Getting start with PostCSS

SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!
SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!
SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!Stefan Bauer
 
WordCamp Asheville 2017 - So You Wanna Dev? Join the Team!
WordCamp Asheville 2017 - So You Wanna Dev? Join the Team!WordCamp Asheville 2017 - So You Wanna Dev? Join the Team!
WordCamp Asheville 2017 - So You Wanna Dev? Join the Team!Evan Mullins
 
Get Started With Tailwind React and Create Beautiful Apps.pdf
Get Started With Tailwind React and Create Beautiful Apps.pdfGet Started With Tailwind React and Create Beautiful Apps.pdf
Get Started With Tailwind React and Create Beautiful Apps.pdfRonDosh
 
Syntactically Awesome Stylesheet - A workshop by Citytech Software
Syntactically Awesome Stylesheet - A workshop by Citytech SoftwareSyntactically Awesome Stylesheet - A workshop by Citytech Software
Syntactically Awesome Stylesheet - A workshop by Citytech SoftwareRitwik Das
 
Create SASSy web parts in SPFx
Create SASSy web parts in SPFxCreate SASSy web parts in SPFx
Create SASSy web parts in SPFxStefan Bauer
 
Create SASSY Web Parts - SPSMilan
Create SASSY Web Parts - SPSMilan Create SASSY Web Parts - SPSMilan
Create SASSY Web Parts - SPSMilan Stefan Bauer
 
SCSS Implementation
SCSS ImplementationSCSS Implementation
SCSS ImplementationAmey Parab
 
Bliblidotcom - SASS Introduction
Bliblidotcom - SASS IntroductionBliblidotcom - SASS Introduction
Bliblidotcom - SASS IntroductionIrfan Maulana
 
So, You Wanna Dev? Join the Team! - WordCamp Raleigh 2017
So, You Wanna Dev? Join the Team! - WordCamp Raleigh 2017 So, You Wanna Dev? Join the Team! - WordCamp Raleigh 2017
So, You Wanna Dev? Join the Team! - WordCamp Raleigh 2017 Evan Mullins
 
Atlanta Drupal User's Group - April 2015 - Sasstronauts: Advanced Sass Topics
Atlanta Drupal User's Group - April 2015 - Sasstronauts: Advanced Sass TopicsAtlanta Drupal User's Group - April 2015 - Sasstronauts: Advanced Sass Topics
Atlanta Drupal User's Group - April 2015 - Sasstronauts: Advanced Sass TopicsEric Sembrat
 
Structuring your CSS for maintainability: rules and guile lines to write CSS
Structuring your CSS for maintainability: rules and guile lines to write CSSStructuring your CSS for maintainability: rules and guile lines to write CSS
Structuring your CSS for maintainability: rules and guile lines to write CSSSanjoy Kr. Paul
 
Introduction of webpack 4
Introduction of webpack 4Introduction of webpack 4
Introduction of webpack 4Vijay Shukla
 
CCSP 2012F 早點下班的工具
CCSP 2012F 早點下班的工具 CCSP 2012F 早點下班的工具
CCSP 2012F 早點下班的工具 裕欽 林
 
Using Sass in Your WordPress Projects
Using Sass in Your WordPress ProjectsUsing Sass in Your WordPress Projects
Using Sass in Your WordPress ProjectsJeremy Green
 
Client Building Functional webapps.
Client   Building Functional webapps.Client   Building Functional webapps.
Client Building Functional webapps.Arun Kumar
 

Ähnlich wie Post css - Getting start with PostCSS (20)

Introducing PostCSS
Introducing PostCSSIntroducing PostCSS
Introducing PostCSS
 
SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!
SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!
SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!
 
WordCamp Asheville 2017 - So You Wanna Dev? Join the Team!
WordCamp Asheville 2017 - So You Wanna Dev? Join the Team!WordCamp Asheville 2017 - So You Wanna Dev? Join the Team!
WordCamp Asheville 2017 - So You Wanna Dev? Join the Team!
 
Get Started With Tailwind React and Create Beautiful Apps.pdf
Get Started With Tailwind React and Create Beautiful Apps.pdfGet Started With Tailwind React and Create Beautiful Apps.pdf
Get Started With Tailwind React and Create Beautiful Apps.pdf
 
Syntactically Awesome Stylesheet - A workshop by Citytech Software
Syntactically Awesome Stylesheet - A workshop by Citytech SoftwareSyntactically Awesome Stylesheet - A workshop by Citytech Software
Syntactically Awesome Stylesheet - A workshop by Citytech Software
 
Create SASSy web parts in SPFx
Create SASSy web parts in SPFxCreate SASSy web parts in SPFx
Create SASSy web parts in SPFx
 
[Bauer] SASSy web parts with SPFX
[Bauer] SASSy web parts with SPFX[Bauer] SASSy web parts with SPFX
[Bauer] SASSy web parts with SPFX
 
Create SASSY Web Parts - SPSMilan
Create SASSY Web Parts - SPSMilan Create SASSY Web Parts - SPSMilan
Create SASSY Web Parts - SPSMilan
 
SCSS Implementation
SCSS ImplementationSCSS Implementation
SCSS Implementation
 
Bliblidotcom - SASS Introduction
Bliblidotcom - SASS IntroductionBliblidotcom - SASS Introduction
Bliblidotcom - SASS Introduction
 
So, You Wanna Dev? Join the Team! - WordCamp Raleigh 2017
So, You Wanna Dev? Join the Team! - WordCamp Raleigh 2017 So, You Wanna Dev? Join the Team! - WordCamp Raleigh 2017
So, You Wanna Dev? Join the Team! - WordCamp Raleigh 2017
 
Atlanta Drupal User's Group - April 2015 - Sasstronauts: Advanced Sass Topics
Atlanta Drupal User's Group - April 2015 - Sasstronauts: Advanced Sass TopicsAtlanta Drupal User's Group - April 2015 - Sasstronauts: Advanced Sass Topics
Atlanta Drupal User's Group - April 2015 - Sasstronauts: Advanced Sass Topics
 
UNIT 3.ppt
UNIT 3.pptUNIT 3.ppt
UNIT 3.ppt
 
Structuring your CSS for maintainability: rules and guile lines to write CSS
Structuring your CSS for maintainability: rules and guile lines to write CSSStructuring your CSS for maintainability: rules and guile lines to write CSS
Structuring your CSS for maintainability: rules and guile lines to write CSS
 
Introduction of webpack 4
Introduction of webpack 4Introduction of webpack 4
Introduction of webpack 4
 
CCSP 2012F 早點下班的工具
CCSP 2012F 早點下班的工具 CCSP 2012F 早點下班的工具
CCSP 2012F 早點下班的工具
 
Using Sass in Your WordPress Projects
Using Sass in Your WordPress ProjectsUsing Sass in Your WordPress Projects
Using Sass in Your WordPress Projects
 
Death of a Themer
Death of a ThemerDeath of a Themer
Death of a Themer
 
Client Building Functional webapps.
Client   Building Functional webapps.Client   Building Functional webapps.
Client Building Functional webapps.
 
Web technology
Web technologyWeb technology
Web technology
 

Kürzlich hochgeladen

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
 
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
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
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
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
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
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
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
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
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
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
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
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
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
 

Kürzlich hochgeladen (20)

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
 
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...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
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
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
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
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
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
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
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
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
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...
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
+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...
 
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
 

Post css - Getting start with PostCSS

  • 1. Getting Started with PostCSS When you are too lazy or too smart By: Neha Sharma | @hellonehha | nehha255@gmail.com
  • 2. AGENDA - Introduction to PostCSS - Popularity of PostCSS - API of PostCSS - Advantages of PostCSS - How to Use PostCSS with Grunt, Gulp, Webpack - Explore PostCSS Plugins - Who is using PostCSS - What is PostCSS is NOT - Where to use PostCSS
  • 4. PostCSS is developed by Andrey Sitnik, creator of Autoprefixer, it was launched as a method to use JavaScript for CSS processing. It is a way of reinventing the css with an ecosystem of custom plugins and tools. It extends the features, syntaxes and enhance the css into browser friendly css.
  • 5. PostCSS on its own is simply an API, which, when used with its vast ecosystem of plugins, offers powerful abilities. It uses the Nodejs Framework - the abilities of the language and tools can be easily modified and customized as needed. PostCSS is agnostic to language format and allows the syntax of different preprocessors such as less, SASS etc
  • 6. Postcss has been growing in popularity.In 2014 there were a little under 1.4 million downloads in total for the year, but from in 2015 there had already been 9.3 million downloads. Source
  • 7. As per the PostCSS github Page: “PostCSS is a tool for transforming CSS with JS plugins. These plugins can support variables and mixins, transpile future CSS syntax, inline images, and more.”
  • 8. PostCSS uses Nodejs framework that parse the CSS into the Abstract Syntax tree. Passes that AST through any number of plugin functions and then converts that AST backs into a string which can output to a file. 1) css.eachRule() // to cycle through each rule set in a file 2) rule.eachDecl() // to cycle through each declaration 3) rule.selector() // to get the selector of a rule 4) atRule.name() // name of an at-rule These APIs make much easier for developer understand how and where the is being transformed and makes easy to work with CSS and to creates its own plugin.It modifies comments, declatation, rules, etc.
  • 9. In a nutshell, PostCSS is more than a pre-processor and it is not Post-processor. PostCSS is a wrapper for lot of things (plugins) to make your css workflow easy and fast. It is a tool for transforming your CSS to JS Plugin PostCSS itself do not parse your css.You need to install itsplugins and based on its requirement plugins will or will not parse your CSS to give you the desire output. It parse your css into the nodes, you can access every node and do the operation as required.
  • 11. PERFORMANCE ““““ TAKES YOU IN FUTURE TAKE CARE OF OLD BROWSERS CREATE YOUR PLUGINS USE WITH REGULAR CSS EASILY DEPLOY WITH OTHER TOOLS MODULAR CSS LOTS OF PLUGINS AUTOMATE YOUR CSS 3X FASTER WRITE SASS WITHOUT SASS
  • 13. PostCSS can be installed with gulp, Grunt, webpack, Broccoli and by CLI too. It is very easy to install and use with other tools. In 2 simple steps we can start using the PostCSS: 1- Find and add PostCSS extensions for your build tool. 2- Select plugins and add them to your PostCSS process. Currently, PostCSS has more than 200 plugins. You can find all of the plugins in the plugins list or in the searchable catalog.
  • 14.
  • 15.
  • 16.
  • 17. Grunt
  • 18.
  • 19. EXPLORE We will be exploring few most popular plugins of postcss with the grunt build tool
  • 20. - Images and Fonts - Grids - Optimizations - Shortcuts - Others PostCSS have lot of plugins related to one can think of and can use any to enhance your work. Do check all the details at - Packs - Future CSS Syntax - Fallbacks - Language Extensions - Colors - Analysis - Reporters - Fun
  • 21. Install Grunt & PostCSS 1- Download nodejs 2- Create your project folder 3- Run command < npm install init > 4- Follow the commands to create package.json 5- Create gruntfile.js to load the package.json 6- Run the command to install PostCSS <npm install grunt-postcss --save-dev > 7- Load the package in gruntfile.js refer to slide 17-18 7- Congratulations your Postcss is installed
  • 22. auto-prefixer Autoprefixer lets you write normal css and makes you forget about prefix as it will handle it by itself. Autoprefix will parse your css and add vendor prefixes to css rule using values from http://caniuse.com/ .It is highly recommended and used by Google, twitter. You can try the interactive demo too. http://autoprefixer.github.io/ Features: - Remove outdated prefixes - Browser support - Actual prefix - Pure css - Support SASS, LESS and Stylus too
  • 24.
  • 25. When to use? - When you are too lazy to take care of support of css property on each browser - When you are too smart to leave it on the plugin to take care when to add prefix and when to not - When you want your project to follow the latest support
  • 26. cssnano CSSnano is built on the top of the POSTCss ecosystem.It is more than just a simple optimization tool. It do advance level of optimization by taking your beautiful written css into high level optimized and clean output. http://cssnano.co/ Features: - Vendor aware rule merging - Pseudo element double-colon syntax reduction - Optimize the z-index value - Remove the outdated pre-fixes - Remove the unused selectors - Convert the font-weight to value - optimize the font-family name - Conversion of length, time & color values
  • 27.
  • 28.
  • 29. precss PreCSS is a tool that let you write your normal css in SASS way. You can enjoy writing Variables, mixins, extends and more sass like syntaxes in your normal CSS. Features: - Let you write SASS like syntax in normal CSS - Let you add Variables - Let you add mixins - Let you add extends - and much more
  • 30.
  • 31.
  • 32. CSSnext cssnext is a css transpiler that allows you to use the latest CSS syntax today. It transforms new CSS specs into more compatible CSS so you don’t need to wait for browser support.A lot of work has been made by the W3C to write new specs to make our life easier which will be coming soon. CSSNext , let us use these new features today itself. Check - http://cssnext.io/ Features: - Custom Variables and properties - Custom media queries - Custom selectors - filters - not pseudo-class - gray support() - automatic prefix support - and many more You can try the interactive demo http://cssnext.io/playground/
  • 33.
  • 34.
  • 35. Who is using PostCSS? Google, Shopify, Twitter Bootstrap, codepen, alibaba, and wordpress are few of the names which are using the PostCSS plugins. Codepen.io recently started the support of the PostCSS plugin.
  • 36. What PostCSS is not? - It is not post processor - It is not pre-processor - It is not build suit - It won’t replace Grunt/Gulp - It is not something for fallbacks - It is not Future css syntax - It is not for optimization and clean CSS
  • 37. Where to use PostCSS - Everywhere - When you want to write CSS as SASS without using sass - When you want to do more by just one plugin - When you want to write Modular CSS not SCSS - When you are CSS Developer who wants to code smarter - When you are too lazy for lots of tasks - When you want to take your css work to next level - When you are ready to explore , experiment and enhance yourself
  • 39. Reference - Smashing Magazine - Webdesign tutsplus - Google - https://github.com/postcss/postcss - and plugins websites