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 6.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. # SugarSS [![Build Status][ci-img]][ci]
  2. <img align="right" width="120" height="155"
  3. title="SugarSS logo by Maria Keller"
  4. src="http://postcss.github.io/sugarss/logo.svg">
  5. Indent-based CSS syntax for [PostCSS].
  6. ```sass
  7. a
  8. color: blue
  9. .multiline,
  10. .selector
  11. box-shadow: 1px 0 9px rgba(0, 0, 0, .4),
  12. 1px 0 3px rgba(0, 0, 0, .6)
  13. // Mobile
  14. @media (max-width: 400px)
  15. .body
  16. padding: 0 10px
  17. ```
  18. As any PostCSS custom syntax, SugarSS has source map, [stylelint]
  19. and [postcss-sorting] support out-of-box.
  20. It was designed to be used with [PreCSS] and [postcss-nested-props].
  21. But you can use it with any PostCSS plugins
  22. or use it without any PostCSS plugins.
  23. With [gulp-sass-to-postcss-mixins] you can use `+mixin` syntax as in Sass.
  24. <a href="https://evilmartians.com/?utm_source=sugarss">
  25. <img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg"
  26. alt="Sponsored by Evil Martians" width="236" height="54">
  27. </a>
  28. [gulp-sass-to-postcss-mixins]: https://github.com/akella/gulp-sass-to-postcss-mixins
  29. [postcss-nested-props]: https://github.com/jedmao/postcss-nested-props
  30. [postcss-sorting]: https://github.com/hudochenkov/postcss-sorting
  31. [stylelint]: http://stylelint.io/
  32. [PostCSS]: https://github.com/postcss/postcss
  33. [PreCSS]: https://github.com/jonathantneal/precss
  34. [ci-img]: https://img.shields.io/travis/postcss/sugarss.svg
  35. [ci]: https://travis-ci.org/postcss/sugarss
  36. ## Syntax
  37. SugarSS MIME-type is `text/x-sugarss` with `.sss` file extension.
  38. ### Indent
  39. We recommend 2 spaces indent. However, SugarSS autodetects indent
  40. and can be used with tabs or spaces.
  41. But it is prohibited to mix spaces and tabs in SugarSS sources.
  42. ### Multiline
  43. SugarSS was designed to have intuitively multiline selectors and declaration
  44. values.
  45. There are 3 rules for any types of nodes:
  46. ```sass
  47. // 1. New line inside brackets will be ignored
  48. @supports ( (display: flex) and
  49. (display: grid) )
  50. // 2. Comma at the end of the line
  51. @media (max-width: 400px),
  52. (max-height: 800px)
  53. // 3. Backslash before new line
  54. @media screen and \
  55. (min-width: 600px)
  56. ```
  57. In selector you can put a new line anywhere. Just keep same indent
  58. for every line of selector:
  59. ```sass
  60. .parent >
  61. .child
  62. color: black
  63. ```
  64. In declaration value you can put new line anywhere. Just keep bigger indent
  65. for value:
  66. ```sass
  67. .one
  68. background: linear-gradient(rgba(0, 0, 0, 0), black)
  69. linear-gradient(red, rgba(255, 0, 0, 0))
  70. .two
  71. background:
  72. linear-gradient(rgba(0, 0, 0, 0), black)
  73. linear-gradient(red, rgba(255, 0, 0, 0))
  74. ```
  75. ### Comments
  76. SugarSS supports two types of comments:
  77. ```sass
  78. /*
  79. Multiline comments
  80. */
  81. // Inline comments
  82. ```
  83. There is no “silent” comments in SugarSS. Output CSS will contain all comments
  84. from `.sss` source. But you can use [postcss-discard-comments]
  85. for Sass’s silent/loud comments behaviour.
  86. [postcss-discard-comments]: https://www.npmjs.com/package/postcss-discard-comments
  87. ### Rule and Declarations
  88. SugarSS separates selectors and declarations by `:\s` or `:\n` token.
  89. So you must write a space after property name: `color: black` is good,
  90. `color:black` is prohibited.
  91. ## Text Editors
  92. * SublimeText: [Syntax Highlighting for .SSS SugarSS]
  93. * Atom: [language-postcss], [source-preview-postcss] and [build-sugarss]
  94. * Vim: [vim-sugarss]
  95. We are working on syntax highlight support in text editors.
  96. Right now, you can set `Sass` or `Stylus` syntax highlight for `.sss` files.
  97. [Syntax Highlighting for .SSS SugarSS]: https://packagecontrol.io/packages/Syntax%20Highlighting%20for%20SSS%20SugarSS
  98. [source-preview-postcss]: https://atom.io/packages/source-preview-postcss
  99. [language-postcss]: https://atom.io/packages/language-postcss
  100. [build-sugarss]: https://atom.io/packages/build-sugarss
  101. [vim-sugarss]: https://github.com/hhsnopek/vim-sugarss
  102. ## Usage
  103. Install SugarSS via npm:
  104. ```sh
  105. npm install sugarss --save-dev
  106. ```
  107. ### SugarSS to CSS
  108. Just set SugarSS to PostCSS `parser` option and PostCSS will compile
  109. SugarSS to CSS.
  110. [Gulp](https://github.com/postcss/gulp-postcss):
  111. ```js
  112. var sugarss = require('sugarss');
  113. var postcss = require('gulp-postcss');
  114. var rename = require('gulp-rename');
  115. gulp.task('style', function () {
  116. return gulp.src('src/**/*.sss')
  117. .pipe(postcss(plugins, { parser: sugarss }))
  118. .pipe(rename({ extname: '.css' }))
  119. .pipe(gulp.dest('build'));
  120. });
  121. ```
  122. [Webpack](https://github.com/postcss/postcss-loader):
  123. ```js
  124. module: {
  125. loaders: [
  126. {
  127. test: /\.sss/,
  128. loader: "style-loader!css-loader!postcss-loader?parser=sugarss"
  129. }
  130. ]
  131. }
  132. ```
  133. [CLI](https://github.com/postcss/postcss-cli):
  134. ```
  135. postcss -u autoprefixer -p sugarss test.sss -o test.css
  136. ```
  137. ### SugarSS to SugarSS
  138. Sometimes we use PostCSS not to build CSS, but to fix source file.
  139. For example, to sort properties by [postcss-sorting].
  140. For this cases, use `syntax` option, instead of `parser`:
  141. ```js
  142. gulp.task('sort', function () {
  143. return gulp.src('src/**/*.sss')
  144. .pipe(postcss([sorting], { syntax: sugarss }))
  145. .pipe(gulp.dest('src'));
  146. });
  147. ```
  148. [postcss-sorting]: https://github.com/hudochenkov/postcss-sorting
  149. ### CSS to SugarSS
  150. You can even compile existed CSS sources to SugarSS syntax.
  151. Just use `stringifier` option instead of `parser`:
  152. ```js
  153. postcss().process(css, { stringifier: sugarss }).then(function (result) {
  154. result.content // Converted SugarSS content
  155. });
  156. ```
  157. ### Imports
  158. [postcss-import] doesn’t support `.sss` file extension, because this plugin
  159. implements W3C specification. If you want smarter `@import`, you should
  160. use [postcss-easy-import] with `extensions` option.
  161. ```js
  162. var postcssPlugin = [
  163. easyImport({ extensions: ['.sss'] })
  164. ]
  165. ```
  166. [postcss-easy-import]: https://github.com/TrySound/postcss-easy-import
  167. [postcss-import]: https://github.com/postcss/postcss-import
  168. ## Thanks
  169. Cute project logo was made by [Maria Keller](http://www.mariakellerac.com/).