|
|
|
|
|
by kibibu
4800 days ago
|
|
> Well, first, there is nothing preventing you from running JS or Java through the C preprocessor (and we did run JavaScript through it at my last job). This is an interesting idea! What was the problem you were solving that required this? --- I think actually the C preprocessor would solve a lot of the problems that, say, SCSS solves too: // put these in a header file, 'cssutil.h'
#define HASH #
#define f(x) x
#define COLOR(c) f(HASH)c
#define PREFIXED(x, y) \
-webkit- ## x : y;\
-moz- ## x : y;\
-o- ## x : y;\
x : y
#define SHADOWED PREFIXED(box-shadow, 10px)
// then in your css
#include "cssutil.h"
#define THEME_BG COLOR(fff)
div.main {
background: THEME_BG;
SHADOWED;
}
There we go, pristine(ish) CSS, unsullied by magic constants and messy prefixes! (note that my preprocessor-fu is weak, I don't know how to do variadic prefixes) |
|