use crate::themes::Theme; const INJECTOR_TEMPLATE: &str = include_str!("./panel/injector.template.js"); pub fn render_injector(host: String, theme: &Theme) -> String { let stylesheet_urls: Vec = theme .files .iter() .map(|f| format!("http://{}/styles/{}/{}", host, &theme.slug, f)) .collect(); let stylesheet_urls = serde_json::to_string(&stylesheet_urls).expect("Couldn't encode stylesheet URLs"); let injector_src = INJECTOR_TEMPLATE.replace("/* STYLESHEET_URLS */null", &stylesheet_urls); minifier::js::minify(&injector_src) }