BeerCSS

Build material design interfaces in record time... without stress for devs....

README

Beer CSS logo

Beer CSS


Build material design interfaces in record time...

...without stress for devs 🍺💛

Cheers, www.beercss.com

Why? ##


- The first CSS framework based on Material Design 3.
- 10x smaller than others CSS frameworks based on Material Design.
- Translates Material Design to HTML semantic standard.
- Ready to use with any JS framework.
- Highly focused on DX.

Applying "the beer way" in css?


This project was guided by the "Germany Beer Purity Law" or "Reinheitsgebot" created in 1516. This law states that beer should only be brewed with the following ingredients: water, barley malt and hops. Only 3 ingredients. Exciting, right? So we thinking about It and our 3 ingredients are: settings, elements and helpers. This sounds weird at first time, because It's not BEM, OOCSS, SMACSS, ITCSS, "Utility first" or any other approach. Our approach doesn't avoid some bad practices, but is lightweight, tasty and pure like a beer. Just try it and feel it! 😁

  1. ```
  2. |  SETTINGS     |       // The settings affects all document
  3. |---------------|----|
  4. |               |    |
  5. |  ELEMENTS     |    |  // The elements are the components, widgets or tags
  6. |               |    |
  7. |---------------|    |
  8. |               |    |
  9. |               |    |
  10. |  HELPERS      |----|  // The common helpers makes the elements more scalable and customizable
  11. |               |
  12. |               |
  13. |---------------|
  14. ```

DO:


  1. ```
  2. // 1 setting to 1 document
  3. <body class="dark|light">...</body>

  4. // 1 element to N helpers
  5. <element class="helper helper">...</element>
  6. <div class="element helper helper">...</div>

  7. // nav elements before all others
  8. <body>
  9.   <nav class="left|right|top|bottom">...</nav>
  10.   ...
  11. </body>

  12. <div id="app">
  13.   <nav class="left|right|top|bottom">...</nav>
  14.   ...
  15. </div>

  16. // write css like this
  17. .element.helper {...}
  18. .element > .element {...}
  19. .element > .helper {...}
  20. ```

DON'T:


  1. ```
  2. // N elements to 1 tag
  3. <div class="element element helper">...</div>

  4. // element with dependencies
  5. <div class="element">
  6.   <div class="element-header">...</div>
  7.   <div class="element-content">...</div>
  8.   <div class="element-footer">...</div>
  9. </div>

  10. // nav elements after all others
  11. <body>
  12.   ...
  13.   <nav class="left|right|top|bottom">...</nav>
  14. </body>

  15. <div id="app">
  16.   ...
  17.   <nav class="left|right|top|bottom">...</nav>
  18. </div>

  19. // write css like this
  20. .element.element {...}
  21. .element .element {...}
  22. .element .helper {...}
  23. ```

Get started


CDN


From jsdelivr.net.

  1. ```html
  2. // with html
  3. <link href="https://cdn.jsdelivr.net/npm/beercss@3.4.2/dist/cdn/beer.min.css" rel="stylesheet" />
  4. <script type="module" src="https://cdn.jsdelivr.net/npm/beercss@3.4.2/dist/cdn/beer.min.js"></script>
  5. <script type="module" src="https://cdn.jsdelivr.net/npm/material-dynamic-colors@1.1.0/dist/cdn/material-dynamic-colors.min.js"></script>
  6. ```

  1. ```css
  2. // with css
  3. @import "https://cdn.jsdelivr.net/npm/beercss@3.4.2/dist/cdn/beer.min.css";
  4. ```

  1. ```js
  2. // with javascript
  3. import "https://cdn.jsdelivr.net/npm/beercss@3.4.2/dist/cdn/beer.min.js";
  4. import "https://cdn.jsdelivr.net/npm/material-dynamic-colors@1.1.0/dist/cdn/material-dynamic-colors.min.js";
  5. ```

NPM


You can get the latest release using NPM. This release contains source files as well as the compiled CSS and JavaScript files.

  1. ```js
  2. // installing
  3. npm i beercss
  4. npm i material-dynamic-colors
  5. ```

  1. ```js
  2. // importing as window.beercss and window.materialDynamicColors
  3. import "beercss";
  4. import "material-dynamic-colors";
  5. ```

  1. ```js
  2. // importing as beercss and materialDynamicColors
  3. import beercss from "beercss";
  4. import materialDynamicColors from "material-dynamic-colors";
  5. ```

  1. ```js
  2. // importing manually from dist
  3. import "beercss/dist/cdn/beer.min.css";
  4. import "beercss/dist/cdn/material-symbols-outlined.woff2";
  5. import "beercss/dist/cdn/material-symbols-rounded.woff2";
  6. import "beercss/dist/cdn/material-symbols-sharp.woff2";
  7. import beercss from "beercss/dist/cdn/beer.min.js";
  8. import materialDynamicColors from "material-dynamic-colors/dist/cdn/material-dynamic-colors.min.js";
  9. ```

  1. ```js
  2. // importing manually from src
  3. import "beercss/src/cdn/beer.css";
  4. import "beercss/src/cdn/material-symbols-outlined.woff2";
  5. import "beercss/src/cdn/material-symbols-rounded.woff2";
  6. import "beercss/src/cdn/material-symbols-sharp.woff2";
  7. import beercss from "beercss/src/cdn/beer.ts";
  8. import materialDynamicColors from "material-dynamic-colors/src/cdn/material-dynamic-colors.js";
  9. ```

HTML


You can use this html to setup your project. See on Codepen.

  1. ```html
  2. <html>
  3.   <head>
  4.     <meta charset="UTF-8">
  5.     <meta name="viewport" content="width=device-width, initial-scale=1">
  6.     <meta http-equiv="X-UA-Compatible" content="ie=edge">
  7.     <meta name="google" content="notranslate">
  8.     <title>Hello world</title>
  9.     <link href="https://cdn.jsdelivr.net/npm/beercss@3.4.2/dist/cdn/beer.min.css" rel="stylesheet">
  10.     <script type="module" src="https://cdn.jsdelivr.net/npm/beercss@3.4.2/dist/cdn/beer.min.js"></script>
  11.     <script type="module" src="https://cdn.jsdelivr.net/npm/material-dynamic-colors@1.1.0/dist/cdn/material-dynamic-colors.min.js"></script>
  12.   </head>
  13.   <body class="light">
  14.     <nav class="left m l">
  15.       <img src="https://www.beercss.com/favicon.png" class="circle margin">
  16.       <a>
  17.         <i>home</i>
  18.         <div>Home</div>
  19.       </a>
  20.       <a>
  21.         <i>search</i>
  22.         <div>Search</div>
  23.       </a>
  24.       <a>
  25.         <i>share</i>
  26.         <div>Share</div>
  27.       </a>
  28.       <a>
  29.         <i>more_vert</i>
  30.         <div>More</div>
  31.       </a>
  32.     </nav>
  33.     <nav class="bottom s">
  34.       <a>
  35.         <i>home</i>
  36.       </a>
  37.       <a>
  38.         <i>search</i>
  39.       </a>
  40.       <a>
  41.         <i>share</i>
  42.       </a>
  43.       <a>
  44.         <i>more_vert</i>
  45.       </a>
  46.     </nav>
  47.     <main class="responsive">
  48.       <img src="https://www.beercss.com/beer-and-woman.jpg" class="responsive round">
  49.       <h3>Welcome</h3>
  50.       <h5>The beer is ready!</h5>
  51.     </main>
  52.   </body>
  53. </html>
  54. ```

We recommend use the material-dynamic-colors only when your app needs to change theme at runtime.

Documentation


Complete documentation and examples available at:


Contributing guide


Hi! We are really excited that you are interested in contributing to Beer CSS! Before submitting your contribution, please make sure to take a moment and read through the following guidelines:

License