# PostCSS [![Travis Build Status][travis-img]][travis] [![AppVeyor Build Status][appveyor-img]][appveyor] [![Gitter][chat-img]][chat]
<img align="right" width="95" height="95"
title="Philosopher’s stone, logo of PostCSS"
src="http://postcss.github.io/postcss/logo.svg">
PostCSS is a tool for transforming styles with JS plugins.
These plugins can support variables and mixins, transpile future CSS syntax,
inline images, and more.
PostCSS is used by industry leaders including Google, Twitter, Alibaba,
and Shopify. The [Autoprefixer] PostCSS plugin is one of the most popular
CSS processors.
PostCSS can do the same work as preprocessors like Sass, Less, and Stylus.
But PostCSS is modular, 3-30 times faster, and much more powerful.
Twitter account: [@postcss](https://twitter.com/postcss).
VK.com page: [postcss](https://vk.com/postcss).
[appveyor-img]: https://img.shields.io/appveyor/ci/ai/postcss.svg?label=windows
[travis-img]: https://img.shields.io/travis/postcss/postcss.svg?label=unix
[chat-img]: https://img.shields.io/badge/Gitter-Join_the_PostCSS_chat-brightgreen.svg
[appveyor]: https://ci.appveyor.com/project/ai/postcss
[travis]: https://travis-ci.org/postcss/postcss
[chat]: https://gitter.im/postcss/postcss
[Examples](#what-is-postcss) | [Features](#features) | [Usage](#usage) | [Syntaxes](#custom-syntaxes) | [Plugins](#plugins) | [Development](#how-to-develop-for-postcss) | [Options](#options)
--- | --- | --- | --- | --- | --- | ---
<a href="https://evilmartians.com/?utm_source=postcss">
<img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg" alt="Sponsored by Evil Martians" width="236" height="54">
</a>
[Autoprefixer]: https://github.com/postcss/autoprefixer
## What is PostCSS
PostCSS itself is very small. It includes only a CSS parser,
a CSS node tree API, a source map generator, and a node tree stringifier.
All of the style transformations are performed by plugins, which are
plain JS functions. Each plugin receives a CSS node tree, transforms it & then
returns the modified tree.
You can use the [cssnext] plugin pack and write future CSS code right now:
```css
:root {
--mainColor: #ffbbaaff;
}
@custom-media --mobile (width <= 640px);
@custom-selector :--heading h1, h2, h3, h4, h5, h6;
.post-article :--heading {
color: color( var(--mainColor) blackness(+20%) );
}
@media (--mobile) {
.post-article :--heading {
margin-top: 0;
}
}
```
Or if you like the Sass syntax, you could use the [PreCSS] plugin pack:
```css
@define-mixin social-icon $network $color {
&.is-$network {
background: $color;
}
}
.social-icon {
@mixin social-icon twitter #55acee;
@mixin social-icon facebook #3b5998;
padding: 10px 5px;
@media (max-width: 640px) {
padding: 0;
}
}
```
[cssnext]: http://cssnext.io/
[PreCSS]: https://github.com/jonathantneal/precss
## Features
Preprocessors are template languages, where you mix styles with code
(like PHP does with HTML).
In contrast, in PostCSS you write a custom subset of CSS.
All code can only be in JS plugins.
As a result, PostCSS offers three main benefits:
* **Performance:** PostCSS, written in JS, is [3 times faster] than libsass,
which is written in C++.
* **Future CSS:** PostCSS plugins can read and rebuild an entire document,
meaning that they can provide new language features. For example, [cssnext]
transpiles the latest W3C drafts to current CSS syntax.
* **New abilities:** PostCSS plugins can read and change every part of styles.
It makes many new classes of tools possible. [Autoprefixer], [`rtlcss`],
[`doiuse`] or [`postcss-colorblind`] are good examples.
[3 times faster]: https://github.com/postcss/benchmark
## Usage
Start using PostCSS in just two steps:
1. Add PostCSS to your build tool.
2. Select plugins from the list below and add them to your PostCSS process.
There are plugins for [Grunt], [Gulp], [webpack], [Broccoli],
[Brunch], [ENB], [Fly], [Stylus] and [Connect/Express].
```js
gulp.task('css', function () {
var postcss = require('gulp-postcss');
return gulp.src('src/**/*.css')
.pipe( postcss([ require('cssnext')(), require('cssnano')() ]) )
.pipe( gulp.dest('build/') );
});
```
For other environments, you can use the [CLI tool] or the JS API:
```js
var postcss = require('postcss');
postcss([ require('cssnext')(), require('cssnano')() ])
.process(css, { from: 'src/app.css', to: 'app.css' })
.then(function (result) {
fs.writeFileSync('app.css', result.css);
if ( result.map ) fs.writeFileSync('app.css.map', result.map);
});
```
If you want to run PostCSS on node.js 0.10, add [Promise polyfill]:
```js
require('es6-promise').polyfill();
var postcss = require('postcss');
```
Read the [PostCSS API] for more details about the JS API.
[Promise polyfill]: https://github.com/jakearchibald/es6-promise
[Connect/Express]: https://github.com/jedmao/postcss-middleware
[PostCSS API]: https://github.com/postcss/postcss/blob/master/docs/api.md
[Broccoli]: https://github.com/jeffjewiss/broccoli-postcss
[CLI tool]: https://github.com/code42day/postcss-cli
[webpack]: https://github.com/postcss/postcss-loader
[Brunch]: https://github.com/iamvdo/postcss-brunch
[Stylus]: https://github.com/seaneking/poststylus
[Grunt]: https://github.com/nDmitry/grunt-postcss
[Gulp]: https://github.com/postcss/gulp-postcss
[ENB]: https://github.com/theprotein/enb-postcss
[Fly]: https://github.com/postcss/fly-postcss
## Custom Syntaxes
PostCSS can transform styles in any syntax, not only in CSS.
There are 3 special arguments in `process()` method to control syntax.
You can even separately set input parser and output stringifier.
* `syntax` accepts object with `parse` and `stringify` functions.
* `parser` accepts input parser function.
* `stringifier` accepts output stringifier function.
```js
var safe = require('postcss-safe-parser');
postcss(plugins).process('a {', { parser: safe }).then(function (result) {
result.css //=> 'a {}'
});
```
### Syntaxes
* [`postcss-scss`] to work with SCSS *(but does not compile SCSS to CSS)*.
[`postcss-scss`]: https://github.com/postcss/postcss-scss
### Parsers
* [`postcss-safe-parser`] finds and fix CSS syntax errors.
[`postcss-safe-parser`]: https://github.com/postcss/postcss-safe-parser
### Stringifiers
* [`midas`] converts a CSS string to highlighted HTML.
[`midas`]: https://github.com/ben-eb/midas
## Plugins
Go to [postcss.parts] for a searchable catalog of the plugins mentioned below.
[postcss.parts]: http://postcss.parts
### Control
There are two ways to make PostCSS magic more explicit.
Limit a plugin's local stylesheet context using [`postcss-plugin-context`]:
```css
.css-example.is-test-for-css4-browsers {
color: gray(255, 50%);
}
@context cssnext {
.css-example.is-fallback-for-all-browsers {
color: gray(255, 50%);
}
}
```
Or enable plugins directly in CSS using [`postcss-use`]:
```css
@use autoprefixer(browsers: ['last 2 versions']);
:fullscreen a {
display: flex
}
```
[`postcss-plugin-context`]: https://github.com/postcss/postcss-plugin-context
[`postcss-use`]: https://github.com/postcss/postcss-use
### Packs
* [`atcss`] contains plugins that transform your CSS according
to special annotation comments.
* [`cssnano`] contains plugins that optimize CSS size for use in production.
* [`cssnext`] contains plugins that allow you to use future CSS features today.
* [`precss`] contains plugins that allow you to use Sass-like CSS.
* [`rucksack`] contains plugins to speed up CSS development
with new features and shortcuts.
* [`stylelint`] contains plugins that lint your stylesheets.
[`stylelint`]: https://github.com/stylelint/stylelint
[`rucksack`]: http://simplaio.github.io/rucksack
[`cssnano`]: https:
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
Sublime Text3 插件包(包含前端大部分常用插件,绝版插件)。 解决 Package Control 网站被墙后,无法下载插件,像LESS2CSS等插件 Package Control都无法搜索到了。 插件包列表: All Autocomplete,AutoFileName,Better CoffeeScript,Bootstrap 3 Autocomplete,BracketHighlighter,ChineseLocalizations,Coffee2Js,CSSLess(ish),CSS Snippets,CSS3,Emmet,HTML Snippets,HTMLBeautify,JavaScript Completions,jQuery,JS Snippets,Less2Css,lessc,List LESS Variables,MarkdownLight,MarkdownPreview,Material Theme,My Snippets,OpenInBrowser。 使用方法: 解压后,将覆盖替换sublime text3 插件包目录文件即可
资源推荐
资源详情
资源评论
收起资源包目录
Sublime Text3 插件包(包含前端大部分常用插件) (3216个子文件)
2.1.0 41B
2.0.0 41B
2.6.0 41B
2.3.0 41B
2.5.0 41B
2.4.0 41B
1.0.0 41B
2.2.0 41B
2.0.0-rc2 41B
2.0.0-rc3 41B
00890b40ac1bcc1f325a32d347bb818078f474 282B
00db00b7cd582c35272d9463136700b74364dc 1KB
020a3c474f23b413d0044938f5f0e619850c67 285B
02223c559cd2839cdf44c51667fbfdf61108a2 223B
0244e86f0e3e21ce0cd7d0afd1af1d48621b56 4KB
029aafbdb6b3f6f0a90dd4ea9114d51bd1b1d9 224B
031fe0fcecf014b6edd78611c374649c9ff487 74B
03320d54ab64cd77f9a304f8ed50b71645e7b3 396B
0339ce94f7767308ee4cdba15e5afef2af0a63 104B
034b99a9eace163a76e61e091345678026cd13 250B
036c8c4d473a1822100ce48af2e26f443a12bc 155B
03938eb5d42dc81faa071d0e8220123678a97d 257B
03a525b5bd87334523fdc97aacde75794cc579 2KB
03aa74ba3aba26e5a49d2aa132805b329595ee 57KB
03bcdbb0ba72ab0fcc8b13f99ef83e517d95e8 528B
03e22f98866cb26bcb9c36acccc7ab2e6167b7 2KB
041b8c21982ecdd9b45353c8cfd800d603f898 187B
041ee40cd05fbd643d8c3f9ce16e7f99389c35 196B
0488c7f1662fe86ca5e3f48c69ed7aed0c9ba9 185B
0491fd7e5bb6fa28c517a0bb32b8b506539d4d 17B
056c497ae925b59c42310945cc16d1f1984b57 1KB
06a47d848c8a5666482f48ca405d3f98536e9b 534B
06a9150af81c9347dc51e4126725ebb0cf5501 3KB
06c0200c86db4338f3f27c5700885a653a0102 2KB
06d2a21ae91c0af1e261bb35205a840b661b54 4KB
070c1e63c2703b2334023922ecc1664f759b55 38KB
0712b3d15bf888e9d57ba78636b75ba913a009 192B
07ac18d949d649697b6165220ff8a1e03e6ccd 417B
082e623fff31af90c877f6128b70b3cc354715 215B
0836977ece6ae4979b2313434c23467a017c70 149B
087a965cd48c660e5716d9c386eac678c42f84 24KB
088c0e7466c3e6c7533d38fb717dddd68808a9 586B
08b1b1abc3f727fe54fdc6653e5310e0105e71 3KB
09516c7c5bb21f83f33fa30f94a26a355d8d2c 202B
09a00fc7db34e7d4215b5d6a98d9adec5b9d72 4KB
09ed6d4c7051ee90dd002ec9fd9a3f347f75a0 3KB
09f0d8b4dad832651a07f7822feb0c5a846ed4 72B
0a89fecbcce30725ed181dfd12a2f88d7126ac 123B
0ae349bf3bf5335bf5ef721c90fa73e32dc192 191B
0b0d06757be23abf1daf3ebebe97bdaa397763 994B
0b53c8942ba78556c232b7e6616b3ab71534d4 70B
0b80455cba0af2e1b2dc383da469218279e30f 820B
0bb5d8fdafd17f5c4b9c65b8a28fb5cfac544a 1KB
0bbd685c34630bc653c7fbf8f924c0cee62b07 71B
0be91e86e80e53d46af6c7f6306a68fd804948 4KB
0bf2725ca670b6c12822ca143195b456c65552 912B
0cbb0221fd444551fbec032561c4d0f19baab6 171B
0cf33a939a4e9c0deb8d0b72a9ecee54e42b3b 49KB
0da250bd0f6cdaa49486ce02c02f0b9c3c6b28 289B
0dbad858fcbf9b06edb7bff74cb8feecaa8b71 35KB
0dec12a2ef6b189764024a40dbd4255e83fed2 332B
0df70b6b55cbedf99f79b6a81e3e45c68a267b 2KB
0e703eb153765b41aa0ed7c979da36517c70e1 26B
0e7903a83e1eea5e7ae64fbd64e9ce92c2ec8e 77B
0e9e7078b38741e9e610d7b9a92a78369a3eb9 1KB
0eb1b62b6c29b33080572dc439afb31b6db622 140B
0ed76091a5c50c70a1d2b4aabe9f0ecb59f66f 138B
0f50ebbd6769adc8b03320798b1ae5e61576fe 334B
0f57fe33d20e364bd48362244cff5632e7caaf 15KB
0f726784ced5aec16586231226314d401d6346 90B
2.4.1 41B
2.3.1 41B
2.0.0-rc.1 41B
2.0.1 41B
2.1.1 41B
2.5.1 41B
1.0.1 41B
2.6.1 41B
105397112a7fa8f38abead04a11b7e53bbbcb1 275B
10b27c33daca7d4b8be6408ea2455485d55241 140B
1128d92f9aa1ff831d603ac2b642ad47bd54da 313B
11350f61d41fac5229cf8226618aa9a6cd4b91 553B
118a7c7268fe7ba708cfbc8296a999bce67d92 35KB
11b862ce44180e724f8bc367a3ba15e6d74ce9 616B
11bd828e76f280c2fff942af0908b5ea4fb2e2 92B
126c4a5d61fdbe2d8d64335553bbe22d4967a3 8KB
1277e8d93bb454a52e7cba0538f47ebf8bddf0 983B
129e315fe593965a2fdd50ec0d1253bcbd2ece 490B
12f27a740729a943c899453a1ca0eae69e31e6 170B
134a3b0b6b7c55802acd252f9142f046ccf27c 54B
1355479579885ffd33b59cf89359808c330096 240B
13a1c2529095aba51bff9413cfe2942d3f2d09 440B
14281ed787f50f2a1581c2f08b329db1a988f9 853B
144735a60509870bae045cb5a7cddee887a8af 33B
154a1717a3bb809c1b32cf3bf43fdce1ac3059 488B
15cf066692cff6f1cc228eeb31632b73cef98a 54B
166bb3c70428e5a154ae7189b5e6bdfe5d50e8 107B
17b9311db8b8a74ec5bcab14e6fc3453ea39ec 674B
1830104185b16c48abd646782ab203a6391585 275B
184b5b467c228f65b70285325163076bdacf29 550B
共 3216 条
- 1
- 2
- 3
- 4
- 5
- 6
- 33
资源评论
一顾倾人倾城
- 粉丝: 2
- 资源: 11
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功