I normally use SCSS, but this should work as well.
=triangle($direction: top, $size: 10px, $color: #000)
width: 0
height: 0
border: $size solid transparent
border-#{$dir}-color: $color