Hello everyone,
I want to use libcss in my own project. I tried my best to get it to work, but
after two days of trying I'm stuck. I figured you guys could give me some
helpful pointers on how to use your lib.
So, what I achieved so far is this:
css_error error = css_initialise(aliases_fname, myrealloc, NULL);
lwc_initialise(myrealloc, NULL, 0);
css_stylesheet *sheet;
error = css_stylesheet_create(CSS_LEVEL_21, "UTF-8",
"url", NULL,
true, false,
myrealloc,
NULL,
myresolveurl,
NULL,
&sheet);
char *style_text = "body\
{\
background-color:#b0c4de;\
}";
uint le = strlen(style_text);
error = css_stylesheet_append_data(sheet, (const uint8_t*)style_text,
le);
error = css_stylesheet_data_done(sheet);
css_finalise(myrealloc, NULL);
style_text is some example css file body. I think it is parsed correctly (I get
CSS_NEEDDATA as a result of css_stylesheet_append_data), but I have no idea how
to actually get the parsed data? How to read background-color of the body
element? Do I have to somehow convert css_stylesheet to css_computed style?
Could you please give me some hints?
Cheers,
Lukasz