際際滷

際際滷Share a Scribd company logo
PostCSS
悋悋惆惘悋 擧惆悽惆悋悧 悛惘愆
@slasharash kadkhodaei.ir
悋惘忰 悋惘忰 悋 惡愕
悛拆悋愕擧 悋惘 悴愕 惆惘 悋惘悋悧
2
擧悋惘惡惘 惘悋惡愀 愆惆 拆惆
#main{
max-width: 1080px;
margin: 0px auto
}
.content{
background: #fff;
}
.block_content{
float: right;
}
.slider{
min-height: 430px;
border: 15px solid #eee;
}
::selection{
background-color:#494949;
color: #eee;
}
@keyframes toLeftFromRight{
49%{transform:translate(-45%)}
50{opacity:0;transform:translate(45%)}
51%{opacity:1}}
#club-section{
Width:100%;
margin:60px 0;
text-align:center;
border-style:solid;
color:#eee;
padding:40px 0;
background:url(/slideshow/introduction-to-postcss/images/club.png);
-webkit-animation:bgAnimate 25s infinite
linear;
-moz-animation:bgAnimate 25s infinite
linear;
-ms-animation:bgAnimate 25s infinite linear;
-o-animation:bgAnimate 25s infinite linear;
animation:bgAnimate 25s infinite linear
}
@media screen and (min-width:60em){
.ba-l {
border-style:solid;
border-width:1px
}
.bt-l{
border-top-style:solid;
border-top-width:1px
}
}
悋惡惠惆悋 悋惘愆 惡悋 悋拆惆擯 惆惘惠
Commenting: selectors, sections components
Naming Conventions: BEM, SUIT, ...
惠悋慍 悋悽悋惠 惡惘悋 惠悋慍 悋慍悋
@nice-blue: #5B83AD;
@light-blue: @nice-blue + #111;
#header {
color: @light-blue;
}
.link {
background-color: @nice-blue;
}
.cards {
width: percentage(@width);
color: saturate(@base, 5%);
background-color: spin(lighten(@base, 25%), 8);
}
VariablesImporting
Functions
Mixins
Scope
Nested Directives
悋盒潮盒朝拆惘惆悋慍惆盒潮盒朝拆愆盒潮
) 拆惘惆悋慍惆拆愆 擧 悋SASS悋LESS.愕惠 (
悛惆 愕擧愕 悋CSS.愕惠
.愕惠 愕悋慍愆惘惆  擧惆 擧惘惆 惠慍 惡惘悋 悋惡慍悋惘 擧 悋
愕擧PostCSS
悋慍悋慍悋慍悋慍
悋愕悋愕愕拆愕惠 悋悋慍 擧惘惆 拆惆悋
PostCSS github repo
postcss.parts
PostCSS Twitter Account
悋愕悋愕愕拆愕惠 愆惘 悋悋慍
PreCSS
@define-mixin icon $name {
padding-left: 16px;
&::after {
content: "";
background-image:
url(/icons/$(name).png);
}
}
.search {
@mixin icon search;
}
.search {
padding-left: 16px;
}
.search::after {
content: "";
background-image:
url(/icons/search.png);
}
悋愕悋愕愕拆愕惠 愆惘 悋悋慍
Autoprefixer
a {
display: flex;
}
a {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
}
悋愕悋愕愕拆愕惠 愆惘 悋悋慍
cssnano
h1::before, h1:before {
/* reduce shorthand even
further */
margin: 10px 20px 10px 20px;
/* reduce color values */
color: #ff0000;
/* remove duplicated properties
*/
font-weight: normal;
font-weight: normal;
h1:before{margin:10px
20px;color:red;border-
radius:16px;font-
weight:normal;background-
position:100% 100%}
悋愕悋愕愕拆愕惠 愆惘 悋悋慍
RTLCSS
div {
margin: 20px 10px 5px 40px;
float: right;
padding-left: 30px;
}
div {
margin: 20px 40px 5px 10px;
float: left;
padding-right: 30px;
}
悋愕悋愕愕拆愕惠 愆惘 悋悋慍
PostCSS Assets
div {
background:
resolve("postcss.png");
}
body {
width:
width("images/foobar.png");
height:
height("images/foobar.png");
background-size:
size("images/foobar.png");
}
div {
background:
url(/slideshow/introduction-to-postcss/94429031/"/images/logos/postcss.png");
}
body {
width: 320px;
height: 240px;
background-size: 320px 240px;
}
悋愕悋愕愕拆愕惠 愆惘 悋悋慍
cssnext
:root {
--fontSize: 1rem;
--mainColor: #12345678;
}
body {
color: var(--mainColor);
font-size: var(--fontSize);
}
body {
color: rgba(18, 52, 86,
0.47059);
font-size: 16px;
font-size: 1rem;
}

More Related Content

Introduction to Postcss

  • 1. PostCSS 悋悋惆惘悋 擧惆悽惆悋悧 悛惘愆 @slasharash kadkhodaei.ir 悋惘忰 悋惘忰 悋 惡愕 悛拆悋愕擧 悋惘 悴愕 惆惘 悋惘悋悧
  • 2. 2 擧悋惘惡惘 惘悋惡愀 愆惆 拆惆 #main{ max-width: 1080px; margin: 0px auto } .content{ background: #fff; } .block_content{ float: right; } .slider{ min-height: 430px; border: 15px solid #eee; } ::selection{ background-color:#494949; color: #eee; } @keyframes toLeftFromRight{ 49%{transform:translate(-45%)} 50{opacity:0;transform:translate(45%)} 51%{opacity:1}} #club-section{ Width:100%; margin:60px 0; text-align:center; border-style:solid; color:#eee; padding:40px 0; background:url(/slideshow/introduction-to-postcss/images/club.png); -webkit-animation:bgAnimate 25s infinite linear; -moz-animation:bgAnimate 25s infinite linear; -ms-animation:bgAnimate 25s infinite linear; -o-animation:bgAnimate 25s infinite linear; animation:bgAnimate 25s infinite linear } @media screen and (min-width:60em){ .ba-l { border-style:solid; border-width:1px } .bt-l{ border-top-style:solid; border-top-width:1px } }
  • 3. 悋惡惠惆悋 悋惘愆 惡悋 悋拆惆擯 惆惘惠 Commenting: selectors, sections components Naming Conventions: BEM, SUIT, ...
  • 4. 惠悋慍 悋悽悋惠 惡惘悋 惠悋慍 悋慍悋 @nice-blue: #5B83AD; @light-blue: @nice-blue + #111; #header { color: @light-blue; } .link { background-color: @nice-blue; } .cards { width: percentage(@width); color: saturate(@base, 5%); background-color: spin(lighten(@base, 25%), 8); } VariablesImporting Functions Mixins Scope Nested Directives
  • 6. ) 拆惘惆悋慍惆拆愆 擧 悋SASS悋LESS.愕惠 ( 悛惆 愕擧愕 悋CSS.愕惠 .愕惠 愕悋慍愆惘惆 擧惆 擧惘惆 惠慍 惡惘悋 悋惡慍悋惘 擧 悋
  • 8. 悋愕悋愕愕拆愕惠 悋悋慍 擧惘惆 拆惆悋 PostCSS github repo postcss.parts PostCSS Twitter Account
  • 9. 悋愕悋愕愕拆愕惠 愆惘 悋悋慍 PreCSS @define-mixin icon $name { padding-left: 16px; &::after { content: ""; background-image: url(/icons/$(name).png); } } .search { @mixin icon search; } .search { padding-left: 16px; } .search::after { content: ""; background-image: url(/icons/search.png); }
  • 10. 悋愕悋愕愕拆愕惠 愆惘 悋悋慍 Autoprefixer a { display: flex; } a { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex; }
  • 11. 悋愕悋愕愕拆愕惠 愆惘 悋悋慍 cssnano h1::before, h1:before { /* reduce shorthand even further */ margin: 10px 20px 10px 20px; /* reduce color values */ color: #ff0000; /* remove duplicated properties */ font-weight: normal; font-weight: normal; h1:before{margin:10px 20px;color:red;border- radius:16px;font- weight:normal;background- position:100% 100%}
  • 12. 悋愕悋愕愕拆愕惠 愆惘 悋悋慍 RTLCSS div { margin: 20px 10px 5px 40px; float: right; padding-left: 30px; } div { margin: 20px 40px 5px 10px; float: left; padding-right: 30px; }
  • 13. 悋愕悋愕愕拆愕惠 愆惘 悋悋慍 PostCSS Assets div { background: resolve("postcss.png"); } body { width: width("images/foobar.png"); height: height("images/foobar.png"); background-size: size("images/foobar.png"); } div { background: url(/slideshow/introduction-to-postcss/94429031/"/images/logos/postcss.png"); } body { width: 320px; height: 240px; background-size: 320px 240px; }
  • 14. 悋愕悋愕愕拆愕惠 愆惘 悋悋慍 cssnext :root { --fontSize: 1rem; --mainColor: #12345678; } body { color: var(--mainColor); font-size: var(--fontSize); } body { color: rgba(18, 52, 86, 0.47059); font-size: 16px; font-size: 1rem; }