I would like to be able to define my tags, fantasy, realism, and mystery as colors:
tagsHash = {
fantasy: red,
realism: blue,
mystery: white
}
#container
createTags(tagsHash)
and then have it produce code like this:
#container
&[data-tag='fantasy']
applyStyles(fantasy)
&[data-tag='realism']
applyStyles(realism)
&[data-tag='mystery']
applyStyles(mystery)
// combination styles
&[data-tag='fantasy'][data-tag='realism']
applyStyles(blend(fantasy, realism))
&[data-tag='realism'][data-tag='mystery']
applyStyles(blend(realism, mystery))
&[data-tag='mystery'][data-tag='fantasy']
applyStyles(blend(mystery, fantasy))
I would like for it to work with arbitrary number of tags with arbitrary colors. New tags would automatically create the needed selectors. Is this possible, and if not what's the closest I can get to it so that adding a new a new tag needs the least amount of changes possible?
from Stylus create multiple styles while changing only 1 array
No comments:
Post a Comment