-
Notifications
You must be signed in to change notification settings - Fork 2
npp_minify
Jurek Muszyński edited this page Dec 19, 2021
·
2 revisions
Minifies NULL-terminated src as CSS or JS and writes result to dest.
Returns new length.
#define COLOR_RED "#b40508" // carefully crafted 'red' we want to use across
// the entire app, as well as many times in CSS
// ...
void create_css() // called from app_init()
{
char dsk[2048];
char mob[2048];
char dsk_min[2048];
char mob_min[2048];
// .w_border style used in .....
sprintf(dsk, ".w_border {color:%s; border:1px solid grey;}", COLOR_RED);
sprintf(mob, ".w_border {color:%s; border:2px solid grey;}", COLOR_RED);
// .no_border style used in .....
sprintf(dsk, " %s .no_border {color:%s; border:0;}", dsk, COLOR_RED);
sprintf(mob, " %s .no_border {color:%s; border:0;}", mob, COLOR_RED);
// ...
npp_minify(dsk_min, dsk);
npp_add_to_static_res("dsk.css", dsk_min);
npp_minify(mob_min, mob);
npp_add_to_static_res("mob.css", mob_min);
}