SlideShare a Scribd company logo
Introducing PostCSS
The Swiss army knife for CSS production
PostCSS Evolution
PostCSS Evolution in npm-stat
From 2015 to today, PostCSS already
has more than 25,884,079 downloads
https://npm-
stat.com/charts.html?package=postcs
s&from=2015-01-01&to=2017-01-01
WTF is PostCSS?
Santisima Trinidad - Los Católicos creen que la
trinidad es una, no creen en tres Dioses sino en un solo
Dios en tres personas distintas, cada una de las
personas es enteramente Dios, Padre, Hijo, Espíritu
Santo tienen la misma naturaleza la misma divinidad,
la misma eternidad, el mismo poder, la misma
perfección.
WTF is PostCSS?
=
what PostCSS is NOT
 The most compelling thing about PostCSS is it is not
restricted to any one type of functionality;
 The diverse functionality available via its plugin
ecosystem
 Its modular, “use what you need” nature
 Its rapid compilation time
 The accessibility of creating your own plugins
 The option to use it with regular CSS
 The ability to create libraries that don’t depend on
one preprocessor
 Its seamless deployment with many popular build
tools
- It’s not a pre-processor (SASS, LESS
…), though it can optionally behave
like one.
- It’s not a post-processor(Autoprefixer
…), though it can optionally behave
like one.
- It’s not about “future syntax”, though
it can facilitate support for future
syntax
- It’s not a clean up / optimization tool,
though it can provide such
functionality.
It’s not any one thing; it’s a means to
potentially unlimited functionality
configured as you choose.
what is PostCSS
So what is PostCSS? The best definition
comes from the project’s own 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.
what is PostCSS
 The tool itself is a Node.js module that parses
CSS into an abstract syntax tree (AST); passes
that AST through any number of “plugin”
functions; and then converts that AST back
into a string,
 The AST provides a very simple API that we
can use to write plugins.
 PostCSS API makes it pretty easy to work with
CSS source code.
what is PostCSS
Rule Structure
A rule or "rule set" is a statement that tells
browsers how to render particular elements on
an HTML page. A rule set consists of a selector
followed by a declaration block.
Finding Plugins
As you start getting into working with
PostCSS there are three locations you’ll
want to keep an eye on for finding great
plugins.
PostCSS Github repo
Catalog Site postcss.parts
@PostCSS Twitter account
#1 Autoprefixer
Autoprefixer uses data from Can I Use.
This way it doesn’t get dated, and can
always apply the most recent rules.
You can check out how it works on
its interactive demo site.
#2. CSSnext
CSSnext is a CSS transpiler that allows
you to use future CSS syntax on current
sites. W3C has many new CSS rules
that aren’t currently implemented by
browsers, but could enable developers
to write more sophisticated CSS faster
and easier. CSSnext has been made to
bridge this gap.
#3. PreCSS
PreCSS is one of the PstCSS plugins
that work like a CSS preprocessor. It
makes it possible to take advantage of
a Sass-like markup in your
sytlesheet files.
You can use variables, if-else
statements, loops, mixins, @extend and
@import rules, nesting …
#4. StyleLint
StyleLint is a modern CSS linter
that proofreads and validates your CSS
code. It makes it easy to avoid errors
and pushes you to follow consistent
coding conventions.
#5. PostCSS Assets
1
2
3
body {
background: resolve('foobar.jpg');
}
The PostCSS Assets plugin is a
handy asset manager for your CSS
files. It can be a great choice if you
tend to have trouble with URL paths, as
PostCSS Assets isolates your stylesheet
files from environmental changes.
#6. CSSNano
CSSNano it’s a modular plugin that
consists of many smaller, single-
responsibility PostCSS plugins. It doesn’t
only perform basic minification
techniques such as removing
whitespaces, but also has advanced
options that make focused
optimizations possible.
Among many other features, CSSNano
is capable of rebasing z-index values,
reducing custom identifiers, converting
length, time and colour values, and
removing outdated vendor prefixes.
SetUp postCSS using Grunt
Gruntfile.js
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-postcss');
};
 Node.js and NPM installed
 npm install grunt-postcss –save-dev
 Create and edit Gruntfile.js
SetUp postCSS using Grunt
Gruntfile.js
module.exports = function(grunt) {
grunt.initConfig({
postcss: {
}
});
grunt.loadNpmTasks('grunt-postcss');
};
 Node.js and NPM installed
 npm install grunt-postcss –save-dev
 Create and edit Gruntfile.js
SetUp postCSS using Grunt
Gruntfile.js
module.exports = function(grunt) {
grunt.initConfig({
postcss: {
options: {
processors: [
require('autoprefixer')()
]
},
dist: {
src: 'css/src/style.css',
dest: 'css/style.css'
}
}
});
grunt.loadNpmTasks('grunt-postcss');
};
 Node.js and NPM installed
 npm install grunt-postcss –save-dev
 Create and edit Gruntfile.js
 npm install autoprefixer –save-dev
How to do your own
PostCSS plugin
What is dinottizator??!!
Convert all the values of font-family property to ‘din-ot’
Creating your PostCSS plugin
Plugins for PostCSS are written in JavaScript, and as such
anyone who can (or NOT !!) write JavaScript can create a
plugin for any purpose they want.
Create a new node module inside your project, which will
become your plugin.
Load your new plugin into your project.
Add some test CSS in the syntax you want your plugin to use.
Use methods from the PostCSS API to scan through a
stylesheet.
Write JavaScript and use the PostCSS API to make the
appropriate transformations (and/or additions) to the original
code and send it into the processed CSS.
Create a Basic Plugin Shell
 Create a folder in node_modules
 All PostCSS plugins are node modules. We need to turn our
new folder into one.
 Cd plugin_name folder
 npm init
 All PostCSS plugins need PostCSS installed as a dependency
 npm install postcss –save-dev
 Create a index.js file
Index.js file
var postcss = require('postcss');
module.exports = postcss.plugin('myplugin', function
myplugin(options) {
return function (css) {
options = options || {};
// Processing code will be added here
}
});
Creating your PostCSS plugin
http://api.postcss.org/AtRule.html#walkRules
Submiting your Plugin
https://github.com/himynameisdave/postcss-
plugins#submitting-a-new-plugin
Introducing PostCSS

More Related Content

What's hot

Intro to Node.js
Intro to Node.jsIntro to Node.js
Intro to Node.js
Jamal Sinclair O'Garro
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
Edy Segura
 
Beyond the MEAN Stack: Thinking Small with Node.js for the Enterprise
Beyond the MEAN Stack: Thinking Small with Node.js for the EnterpriseBeyond the MEAN Stack: Thinking Small with Node.js for the Enterprise
Beyond the MEAN Stack: Thinking Small with Node.js for the Enterprise
Forrest Norvell
 
AWS: First Steps
AWS: First StepsAWS: First Steps
AWS: First Steps
GlobalLogic Ukraine
 
The MEAN Stack: MongoDB, ExpressJS, AngularJS and Node.js
The MEAN Stack: MongoDB, ExpressJS, AngularJS and Node.jsThe MEAN Stack: MongoDB, ExpressJS, AngularJS and Node.js
The MEAN Stack: MongoDB, ExpressJS, AngularJS and Node.js
MongoDB
 
jclouds at HKJUG
jclouds at HKJUGjclouds at HKJUG
jclouds at HKJUG
Everett Toews
 
Nodesummit
NodesummitNodesummit
Nodesummit
Scott Rahner
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
AMD Developer Central
 
On-demand Continuous Integration with Jenkins, jclouds, and CloudStack
On-demand Continuous Integration with Jenkins, jclouds, and CloudStackOn-demand Continuous Integration with Jenkins, jclouds, and CloudStack
On-demand Continuous Integration with Jenkins, jclouds, and CloudStack
ke4qqq
 
D5 - Getting up to speed with type script development - Elio Struyf
D5 - Getting up to speed with type script development - Elio StruyfD5 - Getting up to speed with type script development - Elio Struyf
D5 - Getting up to speed with type script development - Elio Struyf
SPS Paris
 
Visual Studio Team Services を使った Serverless のための継続的デリバリ
Visual Studio Team Services を使った Serverless のための継続的デリバリVisual Studio Team Services を使った Serverless のための継続的デリバリ
Visual Studio Team Services を使った Serverless のための継続的デリバリ
Tsuyoshi Ushio
 
Steps to convert sass to css
Steps to convert sass to cssSteps to convert sass to css
Steps to convert sass to css
Sendhil Kumar Kannan
 
20110421 01 クラウド詳解
20110421 01 クラウド詳解20110421 01 クラウド詳解
20110421 01 クラウド詳解
雄哉 吉田
 
Ryan Markel - WordCamp US 2017
Ryan Markel - WordCamp US 2017Ryan Markel - WordCamp US 2017
Ryan Markel - WordCamp US 2017
ryanmarkel
 
WordCamp IL 2016 - WordPress Scale on AWS
WordCamp IL 2016 - WordPress Scale on AWSWordCamp IL 2016 - WordPress Scale on AWS
WordCamp IL 2016 - WordPress Scale on AWS
Boaz Ziniman
 
NodeJS and what is actually does
NodeJS and what is actually doesNodeJS and what is actually does
NodeJS and what is actually does
Victor Reyes Heitmann
 
node.js 실무 - node js in practice by Jesang Yoon
node.js 실무 - node js in practice by Jesang Yoonnode.js 실무 - node js in practice by Jesang Yoon
node.js 실무 - node js in practice by Jesang Yoon
Jesang Yoon
 
Gérer ses contenus avec MongoDB et Nuxeo
Gérer ses contenus avec MongoDB et NuxeoGérer ses contenus avec MongoDB et Nuxeo
Gérer ses contenus avec MongoDB et Nuxeo
Nuxeo
 

What's hot (20)

Intro to Node.js
Intro to Node.jsIntro to Node.js
Intro to Node.js
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
Beyond the MEAN Stack: Thinking Small with Node.js for the Enterprise
Beyond the MEAN Stack: Thinking Small with Node.js for the EnterpriseBeyond the MEAN Stack: Thinking Small with Node.js for the Enterprise
Beyond the MEAN Stack: Thinking Small with Node.js for the Enterprise
 
AWS: First Steps
AWS: First StepsAWS: First Steps
AWS: First Steps
 
The MEAN Stack: MongoDB, ExpressJS, AngularJS and Node.js
The MEAN Stack: MongoDB, ExpressJS, AngularJS and Node.jsThe MEAN Stack: MongoDB, ExpressJS, AngularJS and Node.js
The MEAN Stack: MongoDB, ExpressJS, AngularJS and Node.js
 
jclouds at HKJUG
jclouds at HKJUGjclouds at HKJUG
jclouds at HKJUG
 
Nodesummit
NodesummitNodesummit
Nodesummit
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
On-demand Continuous Integration with Jenkins, jclouds, and CloudStack
On-demand Continuous Integration with Jenkins, jclouds, and CloudStackOn-demand Continuous Integration with Jenkins, jclouds, and CloudStack
On-demand Continuous Integration with Jenkins, jclouds, and CloudStack
 
Beyond JEE
Beyond JEEBeyond JEE
Beyond JEE
 
D5 - Getting up to speed with type script development - Elio Struyf
D5 - Getting up to speed with type script development - Elio StruyfD5 - Getting up to speed with type script development - Elio Struyf
D5 - Getting up to speed with type script development - Elio Struyf
 
Visual Studio Team Services を使った Serverless のための継続的デリバリ
Visual Studio Team Services を使った Serverless のための継続的デリバリVisual Studio Team Services を使った Serverless のための継続的デリバリ
Visual Studio Team Services を使った Serverless のための継続的デリバリ
 
Steps to convert sass to css
Steps to convert sass to cssSteps to convert sass to css
Steps to convert sass to css
 
20110421 01 クラウド詳解
20110421 01 クラウド詳解20110421 01 クラウド詳解
20110421 01 クラウド詳解
 
Ryan Markel - WordCamp US 2017
Ryan Markel - WordCamp US 2017Ryan Markel - WordCamp US 2017
Ryan Markel - WordCamp US 2017
 
MySQL and SSD
MySQL and SSDMySQL and SSD
MySQL and SSD
 
WordCamp IL 2016 - WordPress Scale on AWS
WordCamp IL 2016 - WordPress Scale on AWSWordCamp IL 2016 - WordPress Scale on AWS
WordCamp IL 2016 - WordPress Scale on AWS
 
NodeJS and what is actually does
NodeJS and what is actually doesNodeJS and what is actually does
NodeJS and what is actually does
 
node.js 실무 - node js in practice by Jesang Yoon
node.js 실무 - node js in practice by Jesang Yoonnode.js 실무 - node js in practice by Jesang Yoon
node.js 실무 - node js in practice by Jesang Yoon
 
Gérer ses contenus avec MongoDB et Nuxeo
Gérer ses contenus avec MongoDB et NuxeoGérer ses contenus avec MongoDB et Nuxeo
Gérer ses contenus avec MongoDB et Nuxeo
 

Viewers also liked

Why react matters
Why react mattersWhy react matters
Why react matters
ShihChi Huang
 
CSS入門教學
CSS入門教學CSS入門教學
CSS入門教學
鈺棠 徐
 
A month by month guide to On Hold Marketing for Restaurants and Hospitality.
A month by month guide to On Hold Marketing for Restaurants and Hospitality.A month by month guide to On Hold Marketing for Restaurants and Hospitality.
A month by month guide to On Hold Marketing for Restaurants and Hospitality.Advitel_crow_greencm15
 
Google blogger 教學
Google blogger 教學Google blogger 教學
Google blogger 教學鈺棠 徐
 
Linux 教育訓練
Linux 教育訓練Linux 教育訓練
Linux 教育訓練
Bo-Yi Wu
 
jQuery入門
jQuery入門jQuery入門
jQuery入門
鈺棠 徐
 
Passing The Joel Test In The PHP World
Passing The Joel Test In The PHP WorldPassing The Joel Test In The PHP World
Passing The Joel Test In The PHP WorldLorna Mitchell
 
PHPUnit best practices presentation
PHPUnit best practices presentationPHPUnit best practices presentation
PHPUnit best practices presentation
Thanh Robi
 
The road to php 7.1
The road to php 7.1The road to php 7.1
The road to php 7.1
Michelangelo van Dam
 
JavaScript/CSS 2015 Autumn
JavaScript/CSS 2015 AutumnJavaScript/CSS 2015 Autumn
JavaScript/CSS 2015 Autumn
Koji Ishimoto
 
Redis for the Everyday Developer
Redis for the Everyday DeveloperRedis for the Everyday Developer
Redis for the Everyday Developer
Ross Tuck
 
Redis in Practice
Redis in PracticeRedis in Practice
Redis in Practice
Noah Davis
 

Viewers also liked (12)

Why react matters
Why react mattersWhy react matters
Why react matters
 
CSS入門教學
CSS入門教學CSS入門教學
CSS入門教學
 
A month by month guide to On Hold Marketing for Restaurants and Hospitality.
A month by month guide to On Hold Marketing for Restaurants and Hospitality.A month by month guide to On Hold Marketing for Restaurants and Hospitality.
A month by month guide to On Hold Marketing for Restaurants and Hospitality.
 
Google blogger 教學
Google blogger 教學Google blogger 教學
Google blogger 教學
 
Linux 教育訓練
Linux 教育訓練Linux 教育訓練
Linux 教育訓練
 
jQuery入門
jQuery入門jQuery入門
jQuery入門
 
Passing The Joel Test In The PHP World
Passing The Joel Test In The PHP WorldPassing The Joel Test In The PHP World
Passing The Joel Test In The PHP World
 
PHPUnit best practices presentation
PHPUnit best practices presentationPHPUnit best practices presentation
PHPUnit best practices presentation
 
The road to php 7.1
The road to php 7.1The road to php 7.1
The road to php 7.1
 
JavaScript/CSS 2015 Autumn
JavaScript/CSS 2015 AutumnJavaScript/CSS 2015 Autumn
JavaScript/CSS 2015 Autumn
 
Redis for the Everyday Developer
Redis for the Everyday DeveloperRedis for the Everyday Developer
Redis for the Everyday Developer
 
Redis in Practice
Redis in PracticeRedis in Practice
Redis in Practice
 

Similar to Introducing PostCSS

Post css - Getting start with PostCSS
Post css - Getting start with PostCSSPost css - Getting start with PostCSS
Post css - Getting start with PostCSS
Neha Sharma
 
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
RonDosh
 
Web technology
Web technologyWeb technology
Web technology
Avinash Saharan
 
Kalastatic: Design+Content-first approaches to static prototyping
Kalastatic: Design+Content-first approaches to static prototypingKalastatic: Design+Content-first approaches to static prototyping
Kalastatic: Design+Content-first approaches to static prototyping
Andrew Mallis
 
Postcss brewbox slides
Postcss brewbox slidesPostcss brewbox slides
Postcss brewbox slides
Michele Mazzucco
 
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
 
Survive JavaScript - Strategies and Tricks
Survive JavaScript - Strategies and TricksSurvive JavaScript - Strategies and Tricks
Survive JavaScript - Strategies and Tricks
Juho Vepsäläinen
 
Making Your Mark [.net Issue 212]
Making Your Mark [.net Issue 212]Making Your Mark [.net Issue 212]
Making Your Mark [.net Issue 212]
Aaron Gustafson
 
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
Eric Sembrat
 
Scss talk CSS Meetup
Scss talk CSS Meetup Scss talk CSS Meetup
Scss talk CSS Meetup
Caleb Yang
 
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
 
Sass is dead
Sass is deadSass is dead
Sass is dead
Eli McMakin
 
SCSS Implementation
SCSS ImplementationSCSS Implementation
SCSS Implementation
Amey Parab
 
CSS vs. JavaScript - Trust vs. Control
CSS vs. JavaScript - Trust vs. ControlCSS vs. JavaScript - Trust vs. Control
CSS vs. JavaScript - Trust vs. Control
Christian Heilmann
 
An Introduction to CSS Frameworks
An Introduction to CSS FrameworksAn Introduction to CSS Frameworks
An Introduction to CSS Frameworks
Adrian Westlake
 
Adopting AnswerModules ModuleSuite
Adopting AnswerModules ModuleSuiteAdopting AnswerModules ModuleSuite
Adopting AnswerModules ModuleSuiteAnswerModules
 
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
Sanjoy Kr. Paul
 
CCSP 2012F 早點下班的工具
CCSP 2012F 早點下班的工具 CCSP 2012F 早點下班的工具
CCSP 2012F 早點下班的工具
裕欽 林
 
Tech talk on Tailwind CSS
Tech talk on Tailwind CSSTech talk on Tailwind CSS
Tech talk on Tailwind CSS
Squareboat
 

Similar to Introducing PostCSS (20)

Post css - Getting start with PostCSS
Post css - Getting start with PostCSSPost css - Getting start with PostCSS
Post css - Getting start with PostCSS
 
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
 
Web technology
Web technologyWeb technology
Web technology
 
Kalastatic: Design+Content-first approaches to static prototyping
Kalastatic: Design+Content-first approaches to static prototypingKalastatic: Design+Content-first approaches to static prototyping
Kalastatic: Design+Content-first approaches to static prototyping
 
Postcss brewbox slides
Postcss brewbox slidesPostcss brewbox slides
Postcss brewbox slides
 
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!
 
Survive JavaScript - Strategies and Tricks
Survive JavaScript - Strategies and TricksSurvive JavaScript - Strategies and Tricks
Survive JavaScript - Strategies and Tricks
 
Making Your Mark [.net Issue 212]
Making Your Mark [.net Issue 212]Making Your Mark [.net Issue 212]
Making Your Mark [.net Issue 212]
 
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
 
Scss talk CSS Meetup
Scss talk CSS Meetup Scss talk CSS Meetup
Scss talk CSS Meetup
 
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!
 
Sass is dead
Sass is deadSass is dead
Sass is dead
 
SCSS Implementation
SCSS ImplementationSCSS Implementation
SCSS Implementation
 
CSS vs. JavaScript - Trust vs. Control
CSS vs. JavaScript - Trust vs. ControlCSS vs. JavaScript - Trust vs. Control
CSS vs. JavaScript - Trust vs. Control
 
An Introduction to CSS Frameworks
An Introduction to CSS FrameworksAn Introduction to CSS Frameworks
An Introduction to CSS Frameworks
 
Adopting AnswerModules ModuleSuite
Adopting AnswerModules ModuleSuiteAdopting AnswerModules ModuleSuite
Adopting AnswerModules ModuleSuite
 
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
 
CCSP 2012F 早點下班的工具
CCSP 2012F 早點下班的工具 CCSP 2012F 早點下班的工具
CCSP 2012F 早點下班的工具
 
Tech talk on Tailwind CSS
Tech talk on Tailwind CSSTech talk on Tailwind CSS
Tech talk on Tailwind CSS
 
Css framework
Css frameworkCss framework
Css framework
 

Introducing PostCSS

  • 1. Introducing PostCSS The Swiss army knife for CSS production
  • 2. PostCSS Evolution PostCSS Evolution in npm-stat From 2015 to today, PostCSS already has more than 25,884,079 downloads https://npm- stat.com/charts.html?package=postcs s&from=2015-01-01&to=2017-01-01
  • 3. WTF is PostCSS? Santisima Trinidad - Los Católicos creen que la trinidad es una, no creen en tres Dioses sino en un solo Dios en tres personas distintas, cada una de las personas es enteramente Dios, Padre, Hijo, Espíritu Santo tienen la misma naturaleza la misma divinidad, la misma eternidad, el mismo poder, la misma perfección.
  • 5.
  • 6. what PostCSS is NOT  The most compelling thing about PostCSS is it is not restricted to any one type of functionality;  The diverse functionality available via its plugin ecosystem  Its modular, “use what you need” nature  Its rapid compilation time  The accessibility of creating your own plugins  The option to use it with regular CSS  The ability to create libraries that don’t depend on one preprocessor  Its seamless deployment with many popular build tools - It’s not a pre-processor (SASS, LESS …), though it can optionally behave like one. - It’s not a post-processor(Autoprefixer …), though it can optionally behave like one. - It’s not about “future syntax”, though it can facilitate support for future syntax - It’s not a clean up / optimization tool, though it can provide such functionality. It’s not any one thing; it’s a means to potentially unlimited functionality configured as you choose.
  • 7. what is PostCSS So what is PostCSS? The best definition comes from the project’s own 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. what is PostCSS  The tool itself is a Node.js module that parses CSS into an abstract syntax tree (AST); passes that AST through any number of “plugin” functions; and then converts that AST back into a string,  The AST provides a very simple API that we can use to write plugins.  PostCSS API makes it pretty easy to work with CSS source code.
  • 9. what is PostCSS Rule Structure A rule or "rule set" is a statement that tells browsers how to render particular elements on an HTML page. A rule set consists of a selector followed by a declaration block.
  • 10. Finding Plugins As you start getting into working with PostCSS there are three locations you’ll want to keep an eye on for finding great plugins. PostCSS Github repo Catalog Site postcss.parts @PostCSS Twitter account
  • 11. #1 Autoprefixer Autoprefixer uses data from Can I Use. This way it doesn’t get dated, and can always apply the most recent rules. You can check out how it works on its interactive demo site.
  • 12. #2. CSSnext CSSnext is a CSS transpiler that allows you to use future CSS syntax on current sites. W3C has many new CSS rules that aren’t currently implemented by browsers, but could enable developers to write more sophisticated CSS faster and easier. CSSnext has been made to bridge this gap.
  • 13. #3. PreCSS PreCSS is one of the PstCSS plugins that work like a CSS preprocessor. It makes it possible to take advantage of a Sass-like markup in your sytlesheet files. You can use variables, if-else statements, loops, mixins, @extend and @import rules, nesting …
  • 14. #4. StyleLint StyleLint is a modern CSS linter that proofreads and validates your CSS code. It makes it easy to avoid errors and pushes you to follow consistent coding conventions.
  • 15. #5. PostCSS Assets 1 2 3 body { background: resolve('foobar.jpg'); } The PostCSS Assets plugin is a handy asset manager for your CSS files. It can be a great choice if you tend to have trouble with URL paths, as PostCSS Assets isolates your stylesheet files from environmental changes.
  • 16. #6. CSSNano CSSNano it’s a modular plugin that consists of many smaller, single- responsibility PostCSS plugins. It doesn’t only perform basic minification techniques such as removing whitespaces, but also has advanced options that make focused optimizations possible. Among many other features, CSSNano is capable of rebasing z-index values, reducing custom identifiers, converting length, time and colour values, and removing outdated vendor prefixes.
  • 17. SetUp postCSS using Grunt Gruntfile.js module.exports = function(grunt) { grunt.loadNpmTasks('grunt-postcss'); };  Node.js and NPM installed  npm install grunt-postcss –save-dev  Create and edit Gruntfile.js
  • 18. SetUp postCSS using Grunt Gruntfile.js module.exports = function(grunt) { grunt.initConfig({ postcss: { } }); grunt.loadNpmTasks('grunt-postcss'); };  Node.js and NPM installed  npm install grunt-postcss –save-dev  Create and edit Gruntfile.js
  • 19. SetUp postCSS using Grunt Gruntfile.js module.exports = function(grunt) { grunt.initConfig({ postcss: { options: { processors: [ require('autoprefixer')() ] }, dist: { src: 'css/src/style.css', dest: 'css/style.css' } } }); grunt.loadNpmTasks('grunt-postcss'); };  Node.js and NPM installed  npm install grunt-postcss –save-dev  Create and edit Gruntfile.js  npm install autoprefixer –save-dev
  • 20. How to do your own PostCSS plugin
  • 21. What is dinottizator??!! Convert all the values of font-family property to ‘din-ot’
  • 22.
  • 23. Creating your PostCSS plugin Plugins for PostCSS are written in JavaScript, and as such anyone who can (or NOT !!) write JavaScript can create a plugin for any purpose they want. Create a new node module inside your project, which will become your plugin. Load your new plugin into your project. Add some test CSS in the syntax you want your plugin to use. Use methods from the PostCSS API to scan through a stylesheet. Write JavaScript and use the PostCSS API to make the appropriate transformations (and/or additions) to the original code and send it into the processed CSS.
  • 24. Create a Basic Plugin Shell  Create a folder in node_modules  All PostCSS plugins are node modules. We need to turn our new folder into one.  Cd plugin_name folder  npm init  All PostCSS plugins need PostCSS installed as a dependency  npm install postcss –save-dev  Create a index.js file
  • 25. Index.js file var postcss = require('postcss'); module.exports = postcss.plugin('myplugin', function myplugin(options) { return function (css) { options = options || {}; // Processing code will be added here } });
  • 26. Creating your PostCSS plugin http://api.postcss.org/AtRule.html#walkRules