3 ms·
After suffering through a project with complex css I felt a similar itch and tried to scratch it by developing http://moonfall.org/ http://moonfall.org/ Its ve
by KevinMS 17y ago
After suffering through a project with complex css I felt a similar itch
and tried to scratch it by developing http://moonfall.org/ http://moonfall.org/
Its very similar to this, differences I see are:
It uses C/Lua, not ruby, so the cool kids probably wont use it.
Its compiled, so no interpreter needs to be installed.
Its very fast so it can be run as a cgi script, either for just
development (avoiding the compile annoyance), or live (as its site
uses now), or run from the command line to avoid the compile overhead
in production.
You can add functions written in lua and compile them into the executable.
The variables are defined in a separate file, so your editor won't freak out
in css mode.
When I introduced it got on smashing magazines best of whatever,
http://www.smashingmagazine.com/2007/08/14/best-of-july-2007/ http://www.smashingmagazine.com/2007/08/14/best-of-july-2007...
I had a lot of css hipsters hating on me... a lot. They despised it.
Their arguments were like "you don't need variables in css, you have
to use the cascade!"
Something like
.my_colored_div, .my_other_colored_div { background-color:red }
... then way further down...
.my_colored_div { width: 100px}
.my_other_colored_div { width: 200px}
So instead of defining something once, (a variable), you should define
something (dom element) in multiple places.
I'm sure its obvious to you guys that defining something in multiple
places like that would end up a big mess. So it didn't bother me so
much being criticised by a group of developers who probably haven't
done more complicated coding than a few pages of php.
Anyway, I'm not promoting moonfall, I honestly don't know if anybody
is even using it, I never did, (although somebody ported it to a perl
module), what I want to say is ever since that project that motivated
me to develop moonfall, I haven't needed it, because the way I
approach css has changed for the better.
I have a few simple rules.
1. Avoid using css, it relatively sucks. Try to let the html do what
it wants. The more css you have, the more you will be fighting the browsers.
2. If you need variables in your css, you are probably making a big
mess that you will regret.
3. If you have a web page that needs a lot of css, its too busy, or
looks too much like a desktop application.
4. Only put global styles in the main css file.
4. My most controversial rule, one that has helped me the most but
will probably bring on the hating... If a style only needs to be used
in one place, or you cannot come up with a good name for it, don't put
it in the css file, put it in the style tag attribute in the html style="blah:blahpx". Trust me,
try it.
- henrrrik 17y agoEven very complex and messy CSS is easily handled using something like Firebug for Firefox or the Web inspector in Safari. I won't even comment on the inline styles recommendation.
- FluidDjango 17y agoThank you for the "shameless" plug for moonfall. I just regret that it never got on my radar - I'm definitely going to test-drive it.