-
Notifications
You must be signed in to change notification settings - Fork 2
npp_add_to_static_res
Jurek Muszyński edited this page Mar 31, 2022
·
2 revisions
Exposes string src as a static resource for the host. Instead of using a file, you may sometimes want to generate something like CSS. Once you've added it, it's visible the same way the other statics are. src has to be a NULL-terminated string.
None
#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);
char tmp[256];
// .no_border style used in .....
sprintf(tmp, " .no_border {color:%s; border:0;}", COLOR_RED);
strcat(dsk, tmp);
sprintf(tmp, " .no_border {color:%s; border:0;}", COLOR_RED);
strcat(mob, tmp);
// ...
npp_minify(dsk_min, dsk);
npp_add_to_static_res(NULL, "dsk.css", dsk_min);
npp_minify(mob_min, mob);
npp_add_to_static_res(NULL, "mob.css", mob_min);
}