35
loading...
This website collects cookies to deliver better user experience
Mixins allow you to define styles that can be re-used throughout your stylesheet.
styles
. I suggest putting all the mixins in under the styles/mixins
. Modularize mixins in meaningful packages: containers, lists, tables, inputs, buttons, typography etc. At this point, I would suggest something that would look like:styles/
|__ mixins/
|__ typography.sass
|__ containers.sass
|__ quote.sass
|__ tables/
|__ compact-table.sass
|__ data-table.sass
quote
mixin. This mixin can add some quote-like style to an element: a grey background, some padding, some font style and color.@mixin quote
font-style: italic
background: rgb(240,240,240)
border-left: 2px solid rgb(200,200,200)
color: rgb(100,100,100)
padding: 10px
<p class="main-quote">Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>
<p class="second-quote">Molestiae tempore officiis animi sint, corporis officia, vel eaque in, quaerat exercitationem ut.</p>
@use 'mixins/quote'
.main-quote
@include quote.quote
font-size: 20px
.second-quote
@include quote.quote
<p>
, the classes are then defined in the SASS file of the component. We can then apply several mixins to each class.<p>
seems to be a tedious process, it actually makes sure our template stays clean: we don't overload class attributes. Style definitions are specified in the SASS file.