Skip to content

alepop/amsass-mixin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

amsass-mixin

The Attribute-Module SASS (AMCSS) mixins

#Installing

Plug this file to your project.

@import "amsass-mixins"

Define prefixes for your modules

$am-prefix: ui

#Usage Once you have imported the file and declared a variable, you can start using mixins

+module(Button)
  border: 1px solid black
  background: #ccc
  color: white
  &:hover
    color: black
  +variant(warning)
    background: red
  +variant(success)
    background: green

This will be compiled into the following css code:

[ui-Button] {
  border: 1px solid black;
  background: #ccc;
  color: white;
}
[ui-Button]:hover {
  color: black;
}
[ui-Button~="warning"] {
  background: red;
}
[ui-Button~="success"] {
  background: green;
}

You can also use nesting

+module(Button)
  border: 1px solid black
  background: #ccc
  color: white
  +variant(warning)
    background: red
  +child(child)
    color: red
    background: white
    +variant(bad)
      background: none

Result

[ui-Button] {
  border: 1px solid black;
  background: #ccc;
  color: white;
}
[ui-Button~="warning"] {
  background: red;
}
[ui-Button-child] {
  color: red;
  background: white;
}
[ui-Button-child~="bad"] {
  background: none;
}

About

The Attribute-Module SASS (AMCSS) mixins

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages