Flavors vs.Themes for CSS Libraries
Colors
aside there's a lot more happening
in
css themes that
one
needs
to
develop or
maintain.
So
I've
asked myself countless times if I should just create my own Css
library but time was always against me. I think having bootstrap as a
base line is a good starting point. Not only for
my sake but non
front-end
developers. As a
front-end
developer organization
with my teams is critical. Every application sooner or later
ends up with too many developers doing their “own thing”
especially
with the styles if there is not standard or
company brand.
Don't get me wrong the
freedom
can sometimes be great for a creative projects. However when looking
to creating a brand, my applications need to force some rules.
I'm not looking to challenge
other developers on their approach
to
new
things or change the way they develop. If I can include them in my
work flow and at the same
time
organize them then I will.
So
what I'm leading up to is this idea flavors instead of themes. For
awhile I've been working on my npm packages called
flavorstrap. Currently it only works locally, so you'll have to look
at the package it's self to see how it works. Or if you want to do
without it you can look at my bootstrap-sidenav-component also on
github. Flavorstrap is really just a bundle of packages and follows
a work-flow I've created to help my team without changing the way
they develop! It's awesome I can now let anyone develop however they
choose just make sure they use
separate
files
(per developer).
Later I go in and change it to sass if it's not already. Then I just
merge and cleanup the css for production but
what's the difference from a theme!?
To
do this I create a couple of rules for myself in order to make things
easier for myself.
The
first rule is that I'm
are not going to work against the
base css library; interface
and
leverage
it. This
is different from a css
theme, which is just another css that seats on top the
base
css library. A flavor is the opposite, it allows you to integrate
rather than seat on top the css library. This
doesn't just work with bootstrap it could work with any css library
if created, plus your dependencies with a given css library would be
clearer. Meaning that if a class became deprecated, the sass compiler
would simply fail. Giving you an idea where to make changes with your
flavor of the css library.