Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 17KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491
  1. # PostCSS [![Gitter][chat-img]][chat]
  2. <img align="right" width="95" height="95"
  3. alt="Philosopher’s stone, logo of PostCSS"
  4. src="http://postcss.github.io/postcss/logo.svg">
  5. [chat-img]: https://img.shields.io/badge/Gitter-Join_the_PostCSS_chat-brightgreen.svg
  6. [chat]: https://gitter.im/postcss/postcss
  7. PostCSS is a tool for transforming styles with JS plugins.
  8. These plugins can lint your CSS, support variables and mixins,
  9. transpile future CSS syntax, inline images, and more.
  10. PostCSS is used by industry leaders including Wikipedia, Twitter, Alibaba,
  11. and JetBrains. The [Autoprefixer] PostCSS plugin is one of the most popular
  12. CSS processors.
  13. PostCSS takes a CSS file and provides an API to analyze and modify its rules
  14. (by transforming them into an [Abstract Syntax Tree]).
  15. This API can then be used by [plugins] to do a lot of useful things,
  16. e.g. to find errors automatically insert vendor prefixes.
  17. **Support / Discussion:** [Gitter](https://gitter.im/postcss/postcss)<br>
  18. **Twitter account:** [@postcss](https://twitter.com/postcss)<br>
  19. **VK.com page:** [postcss](https://vk.com/postcss)<br>
  20. **中文翻译**: [`README-cn.md`](./README-cn.md)
  21. For PostCSS commercial support (consulting, improving the front-end culture
  22. of your company, PostCSS plugins), contact [Evil Martians]
  23. at <surrender@evilmartians.com>.
  24. [Abstract Syntax Tree]: https://en.wikipedia.org/wiki/Abstract_syntax_tree
  25. [Evil Martians]: https://evilmartians.com/?utm_source=postcss
  26. [Autoprefixer]: https://github.com/postcss/autoprefixer
  27. [plugins]: https://github.com/postcss/postcss#plugins
  28. <a href="https://evilmartians.com/?utm_source=postcss">
  29. <img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg"
  30. alt="Sponsored by Evil Martians" width="236" height="54">
  31. </a>
  32. ## Sponsorship
  33. PostCSS needs your support. We are accepting donations
  34. [at Open Collective](https://opencollective.com/postcss/).
  35. <a href="https://tailwindcss.com/">
  36. <img src="https://refactoringui.nyc3.cdn.digitaloceanspaces.com/tailwind-logo.svg"
  37. alt="Sponsored by Tailwind CSS" width="273" height="64">
  38. </a>
  39. ## Plugins
  40. Currently, PostCSS has more than 200 plugins. You can find all of the plugins
  41. in the [plugins list] or in the [searchable catalog]. Below is a list
  42. of our favorite plugins — the best demonstrations of what can be built
  43. on top of PostCSS.
  44. If you have any new ideas, [PostCSS plugin development] is really easy.
  45. [searchable catalog]: http://postcss.parts
  46. [plugins list]: https://github.com/postcss/postcss/blob/master/docs/plugins.md
  47. ### Solve Global CSS Problem
  48. * [`postcss-use`] allows you to explicitly set PostCSS plugins within CSS
  49. and execute them only for the current file.
  50. * [`postcss-modules`] and [`react-css-modules`] automatically isolate
  51. selectors within components.
  52. * [`postcss-autoreset`] is an alternative to using a global reset
  53. that is better for isolatable components.
  54. * [`postcss-initial`] adds `all: initial` support, which resets
  55. all inherited styles.
  56. * [`cq-prolyfill`] adds container query support, allowing styles that respond
  57. to the width of the parent.
  58. ### Use Future CSS, Today
  59. * [`autoprefixer`] adds vendor prefixes, using data from Can I Use.
  60. * [`postcss-preset-env`] allows you to use future CSS features today.
  61. ### Better CSS Readability
  62. * [`precss`] contains plugins for Sass-like features, like variables, nesting,
  63. and mixins.
  64. * [`postcss-sorting`] sorts the content of rules and at-rules.
  65. * [`postcss-utilities`] includes the most commonly used shortcuts and helpers.
  66. * [`short`] adds and extends numerous shorthand properties.
  67. ### Images and Fonts
  68. * [`postcss-assets`] inserts image dimensions and inlines files.
  69. * [`postcss-sprites`] generates image sprites.
  70. * [`font-magician`] generates all the `@font-face` rules needed in CSS.
  71. * [`postcss-inline-svg`] allows you to inline SVG and customize its styles.
  72. * [`postcss-write-svg`] allows you to write simple SVG directly in your CSS.
  73. ### Linters
  74. * [`stylelint`] is a modular stylesheet linter.
  75. * [`stylefmt`] is a tool that automatically formats CSS
  76. according `stylelint` rules.
  77. * [`doiuse`] lints CSS for browser support, using data from Can I Use.
  78. * [`colorguard`] helps you maintain a consistent color palette.
  79. ### Other
  80. * [`postcss-rtl`] combines both-directional (left-to-right and right-to-left) styles in one CSS file.
  81. * [`cssnano`] is a modular CSS minifier.
  82. * [`lost`] is a feature-rich `calc()` grid system.
  83. * [`rtlcss`] mirrors styles for right-to-left locales.
  84. [PostCSS plugin development]: https://github.com/postcss/postcss/blob/master/docs/writing-a-plugin.md
  85. [`postcss-inline-svg`]: https://github.com/TrySound/postcss-inline-svg
  86. [`postcss-preset-env`]: https://github.com/jonathantneal/postcss-preset-env
  87. [`react-css-modules`]: https://github.com/gajus/react-css-modules
  88. [`postcss-autoreset`]: https://github.com/maximkoretskiy/postcss-autoreset
  89. [`postcss-write-svg`]: https://github.com/jonathantneal/postcss-write-svg
  90. [`postcss-utilities`]: https://github.com/ismamz/postcss-utilities
  91. [`postcss-initial`]: https://github.com/maximkoretskiy/postcss-initial
  92. [`postcss-sprites`]: https://github.com/2createStudio/postcss-sprites
  93. [`postcss-modules`]: https://github.com/outpunk/postcss-modules
  94. [`postcss-sorting`]: https://github.com/hudochenkov/postcss-sorting
  95. [`postcss-assets`]: https://github.com/assetsjs/postcss-assets
  96. [`font-magician`]: https://github.com/jonathantneal/postcss-font-magician
  97. [`autoprefixer`]: https://github.com/postcss/autoprefixer
  98. [`cq-prolyfill`]: https://github.com/ausi/cq-prolyfill
  99. [`postcss-rtl`]: https://github.com/vkalinichev/postcss-rtl
  100. [`postcss-use`]: https://github.com/postcss/postcss-use
  101. [`css-modules`]: https://github.com/css-modules/css-modules
  102. [`colorguard`]: https://github.com/SlexAxton/css-colorguard
  103. [`stylelint`]: https://github.com/stylelint/stylelint
  104. [`stylefmt`]: https://github.com/morishitter/stylefmt
  105. [`cssnano`]: http://cssnano.co
  106. [`precss`]: https://github.com/jonathantneal/precss
  107. [`doiuse`]: https://github.com/anandthakker/doiuse
  108. [`rtlcss`]: https://github.com/MohammadYounes/rtlcss
  109. [`short`]: https://github.com/jonathantneal/postcss-short
  110. [`lost`]: https://github.com/peterramsing/lost
  111. ## Syntaxes
  112. PostCSS can transform styles in any syntax, not just CSS.
  113. If there is not yet support for your favorite syntax,
  114. you can write a parser and/or stringifier to extend PostCSS.
  115. * [`sugarss`] is a indent-based syntax like Sass or Stylus.
  116. * [`postcss-syntax`] switch syntax automatically by file extensions.
  117. * [`postcss-html`] parsing styles in `<style>` tags of HTML-like files.
  118. * [`postcss-markdown`] parsing styles in code blocks of Markdown files.
  119. * [`postcss-jsx`] parsing CSS in template / object literals of source files.
  120. * [`postcss-styled`] parsing CSS in template literals of source files.
  121. * [`postcss-scss`] allows you to work with SCSS
  122. *(but does not compile SCSS to CSS)*.
  123. * [`postcss-sass`] allows you to work with Sass
  124. *(but does not compile Sass to CSS)*.
  125. * [`postcss-less`] allows you to work with Less
  126. *(but does not compile LESS to CSS)*.
  127. * [`postcss-less-engine`] allows you to work with Less
  128. *(and DOES compile LESS to CSS using true Less.js evaluation)*.
  129. * [`postcss-js`] allows you to write styles in JS or transform
  130. React Inline Styles, Radium or JSS.
  131. * [`postcss-safe-parser`] finds and fixes CSS syntax errors.
  132. * [`midas`] converts a CSS string to highlighted HTML.
  133. [`postcss-less-engine`]: https://github.com/Crunch/postcss-less
  134. [`postcss-safe-parser`]: https://github.com/postcss/postcss-safe-parser
  135. [`postcss-syntax`]: https://github.com/gucong3000/postcss-syntax
  136. [`postcss-html`]: https://github.com/gucong3000/postcss-html
  137. [`postcss-markdown`]: https://github.com/gucong3000/postcss-markdown
  138. [`postcss-jsx`]: https://github.com/gucong3000/postcss-jsx
  139. [`postcss-styled`]: https://github.com/gucong3000/postcss-styled
  140. [`postcss-scss`]: https://github.com/postcss/postcss-scss
  141. [`postcss-sass`]: https://github.com/AleshaOleg/postcss-sass
  142. [`postcss-less`]: https://github.com/webschik/postcss-less
  143. [`postcss-js`]: https://github.com/postcss/postcss-js
  144. [`sugarss`]: https://github.com/postcss/sugarss
  145. [`midas`]: https://github.com/ben-eb/midas
  146. ## Articles
  147. * [Some things you may think about PostCSS… and you might be wrong](http://julian.io/some-things-you-may-think-about-postcss-and-you-might-be-wrong)
  148. * [What PostCSS Really Is; What It Really Does](http://davidtheclark.com/its-time-for-everyone-to-learn-about-postcss)
  149. * [PostCSS Guides](http://webdesign.tutsplus.com/series/postcss-deep-dive--cms-889)
  150. More articles and videos you can find on [awesome-postcss](https://github.com/jjaderg/awesome-postcss) list.
  151. ## Books
  152. * [Mastering PostCSS for Web Design](https://www.packtpub.com/web-development/mastering-postcss-web-design) by Alex Libby, Packt. (June 2016)
  153. ## Usage
  154. You can start using PostCSS in just two steps:
  155. 1. Find and add PostCSS extensions for your build tool.
  156. 2. [Select plugins] and add them to your PostCSS process.
  157. [Select plugins]: http://postcss.parts
  158. ### CSS-in-JS
  159. The best way to use PostCSS with CSS-in-JS is [`astroturf`].
  160. Add its loader to your `webpack.config.js`:
  161. ```js
  162. module.exports = {
  163. module: {
  164. rules: [
  165. {
  166. test: /\.css$/,
  167. use: ['style-loader', 'postcss-loader'],
  168. },
  169. {
  170. test: /\.jsx?$/,
  171. use: ['babel-loader', 'astroturf/loader'],
  172. }
  173. ]
  174. }
  175. }
  176. ```
  177. Then create `postcss.config.js`:
  178. ```js
  179. module.exports = {
  180. plugins: [
  181. require('autoprefixer'),
  182. require('postcss-nested')
  183. ]
  184. }
  185. ```
  186. [`astroturf`]: https://github.com/4Catalyzer/astroturf
  187. ### Parcel
  188. [Parcel] has built-in PostCSS support. It already uses Autoprefixer
  189. and cssnano. If you want to change plugins, create `postcss.config.js`
  190. in project’s root:
  191. ```js
  192. module.exports = {
  193. plugins: [
  194. require('autoprefixer'),
  195. require('postcss-nested')
  196. ]
  197. }
  198. ```
  199. Parcel will even automatically install these plugins for you.
  200. > Please, be aware of [the several issues in Version 1](https://github.com/parcel-bundler/parcel/labels/CSS%20Preprocessing). Notice, [Version 2](https://github.com/parcel-bundler/parcel/projects/5) may resolve the issues via [issue #2157](https://github.com/parcel-bundler/parcel/issues/2157).
  201. [Parcel]: https://parceljs.org
  202. ### Webpack
  203. Use [`postcss-loader`] in `webpack.config.js`:
  204. ```js
  205. module.exports = {
  206. module: {
  207. rules: [
  208. {
  209. test: /\.css$/,
  210. exclude: /node_modules/,
  211. use: [
  212. {
  213. loader: 'style-loader',
  214. },
  215. {
  216. loader: 'css-loader',
  217. options: {
  218. importLoaders: 1,
  219. }
  220. },
  221. {
  222. loader: 'postcss-loader'
  223. }
  224. ]
  225. }
  226. ]
  227. }
  228. }
  229. ```
  230. Then create `postcss.config.js`:
  231. ```js
  232. module.exports = {
  233. plugins: [
  234. require('precss'),
  235. require('autoprefixer')
  236. ]
  237. }
  238. ```
  239. [`postcss-loader`]: https://github.com/postcss/postcss-loader
  240. ### Gulp
  241. Use [`gulp-postcss`] and [`gulp-sourcemaps`].
  242. ```js
  243. gulp.task('css', () => {
  244. const postcss = require('gulp-postcss')
  245. const sourcemaps = require('gulp-sourcemaps')
  246. return gulp.src('src/**/*.css')
  247. .pipe( sourcemaps.init() )
  248. .pipe( postcss([ require('precss'), require('autoprefixer') ]) )
  249. .pipe( sourcemaps.write('.') )
  250. .pipe( gulp.dest('build/') )
  251. })
  252. ```
  253. [`gulp-sourcemaps`]: https://github.com/floridoo/gulp-sourcemaps
  254. [`gulp-postcss`]: https://github.com/postcss/gulp-postcss
  255. ### npm run / CLI
  256. To use PostCSS from your command-line interface or with npm scripts
  257. there is [`postcss-cli`].
  258. ```sh
  259. postcss --use autoprefixer -c options.json -o main.css css/*.css
  260. ```
  261. [`postcss-cli`]: https://github.com/postcss/postcss-cli
  262. ### Browser
  263. If you want to compile CSS string in browser (for instance, in live edit
  264. tools like CodePen), just use [Browserify] or [webpack]. They will pack
  265. PostCSS and plugins files into a single file.
  266. To apply PostCSS plugins to React Inline Styles, JSS, Radium
  267. and other [CSS-in-JS], you can use [`postcss-js`] and transforms style objects.
  268. ```js
  269. var postcss = require('postcss-js')
  270. var prefixer = postcss.sync([ require('autoprefixer') ])
  271. prefixer({ display: 'flex' }) //=> { display: ['-webkit-box', '-webkit-flex', '-ms-flexbox', 'flex'] }
  272. ```
  273. [`postcss-js`]: https://github.com/postcss/postcss-js
  274. [Browserify]: http://browserify.org/
  275. [CSS-in-JS]: https://github.com/MicheleBertoli/css-in-js
  276. [webpack]: https://webpack.github.io/
  277. ### Runners
  278. * **Grunt**: [`grunt-postcss`](https://github.com/nDmitry/grunt-postcss)
  279. * **HTML**: [`posthtml-postcss`](https://github.com/posthtml/posthtml-postcss)
  280. * **Stylus**: [`poststylus`](https://github.com/seaneking/poststylus)
  281. * **Rollup**: [`rollup-plugin-postcss`](https://github.com/egoist/rollup-plugin-postcss)
  282. * **Brunch**: [`postcss-brunch`](https://github.com/brunch/postcss-brunch)
  283. * **Broccoli**: [`broccoli-postcss`](https://github.com/jeffjewiss/broccoli-postcss)
  284. * **Meteor**: [`postcss`](https://atmospherejs.com/juliancwirko/postcss)
  285. * **ENB**: [`enb-postcss`](https://github.com/awinogradov/enb-postcss)
  286. * **Taskr**: [`taskr-postcss`](https://github.com/lukeed/taskr/tree/master/packages/postcss)
  287. * **Start**: [`start-postcss`](https://github.com/start-runner/postcss)
  288. * **Connect/Express**: [`postcss-middleware`](https://github.com/jedmao/postcss-middleware)
  289. ### JS API
  290. For other environments, you can use the JS API:
  291. ```js
  292. const autoprefixer = require('autoprefixer')
  293. const postcss = require('postcss')
  294. const precss = require('precss')
  295. const fs = require('fs')
  296. fs.readFile('src/app.css', (err, css) => {
  297. postcss([precss, autoprefixer])
  298. .process(css, { from: 'src/app.css', to: 'dest/app.css' })
  299. .then(result => {
  300. fs.writeFile('dest/app.css', result.css, () => true)
  301. if ( result.map ) {
  302. fs.writeFile('dest/app.css.map', result.map, () => true)
  303. }
  304. })
  305. })
  306. ```
  307. Read the [PostCSS API documentation] for more details about the JS API.
  308. All PostCSS runners should pass [PostCSS Runner Guidelines].
  309. [PostCSS Runner Guidelines]: https://github.com/postcss/postcss/blob/master/docs/guidelines/runner.md
  310. [PostCSS API documentation]: http://api.postcss.org/postcss.html
  311. ### Options
  312. Most PostCSS runners accept two parameters:
  313. * An array of plugins.
  314. * An object of options.
  315. Common options:
  316. * `syntax`: an object providing a syntax parser and a stringifier.
  317. * `parser`: a special syntax parser (for example, [SCSS]).
  318. * `stringifier`: a special syntax output generator (for example, [Midas]).
  319. * `map`: [source map options].
  320. * `from`: the input file name (most runners set it automatically).
  321. * `to`: the output file name (most runners set it automatically).
  322. [source map options]: https://github.com/postcss/postcss/blob/master/docs/source-maps.md
  323. [Midas]: https://github.com/ben-eb/midas
  324. [SCSS]: https://github.com/postcss/postcss-scss
  325. ### Treat Warnings as Errors
  326. In some situations it might be helpful to fail the build on any warning
  327. from PostCSS or one of its plugins. This guarantees that no warnings
  328. go unnoticed, and helps to avoid bugs. While there is no option to enable
  329. treating warnings as errors, it can easily be done
  330. by adding `postcss-fail-on-warn` plugin in the end of PostCSS plugins:
  331. ```js
  332. module.exports = {
  333. plugins: [
  334. require('autoprefixer'),
  335. require('postcss-fail-on-warn')
  336. ]
  337. }
  338. ```
  339. ## Contributing
  340. [Our contributing guidelines](./CONTRIBUTING.md) will help you
  341. with making pull request to this project.
  342. ## Editors & IDE Integration
  343. ### VS Code
  344. * [`csstools.postcss`] adds support for PostCSS, `postcss-preset-env`
  345. and CSS Modules.
  346. [`csstools.postcss`]: https://marketplace.visualstudio.com/items?itemName=csstools.postcss
  347. ### Atom
  348. * [`language-postcss`] adds PostCSS and [SugarSS] highlight.
  349. * [`source-preview-postcss`] previews your output CSS in a separate, live pane.
  350. [SugarSS]: https://github.com/postcss/sugarss
  351. ### Sublime Text
  352. * [`Syntax-highlighting-for-PostCSS`] adds PostCSS highlight.
  353. [`Syntax-highlighting-for-PostCSS`]: https://github.com/hudochenkov/Syntax-highlighting-for-PostCSS
  354. [`source-preview-postcss`]: https://atom.io/packages/source-preview-postcss
  355. [`language-postcss`]: https://atom.io/packages/language-postcss
  356. ### Vim
  357. * [`postcss.vim`] adds PostCSS highlight.
  358. [`postcss.vim`]: https://github.com/stephenway/postcss.vim
  359. ### WebStorm
  360. WebStorm 2016.3 [has] built-in PostCSS support.
  361. [has]: https://blog.jetbrains.com/webstorm/2016/08/webstorm-2016-3-early-access-preview/
  362. ## Security Contact
  363. To report a security vulnerability, please use the [Tidelift security contact].
  364. Tidelift will coordinate the fix and disclosure.
  365. [Tidelift security contact]: https://tidelift.com/security
  366. ## For Enterprise
  367. Available as part of the Tidelift Subscription.
  368. The maintainers of `postcss` and thousands of other packages are working
  369. with Tidelift to deliver commercial support and maintenance for the open source
  370. dependencies you use to build your applications. Save time, reduce risk,
  371. and improve code health, while paying the maintainers of the exact dependencies
  372. you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-postcss?utm_source=npm-postcss&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)