Export a view into a single HTML file on disk, containing - View XML - embedded - Assets - referenced as remote resources
| 265 | |
| 266 | |
| 267 | class ExportHTMLFileAssets(BaseExportHTML): |
| 268 | """ |
| 269 | Export a view into a single HTML file on disk, containing |
| 270 | - View XML - embedded |
| 271 | - Assets - referenced as remote resources |
| 272 | """ |
| 273 | |
| 274 | template_name = "local_template.html" |
| 275 | |
| 276 | def __init__(self, app_dir: Path, name: str = "app", formatting: t.Optional[Formatting] = None): |
| 277 | self.app_dir = app_dir |
| 278 | self.name = name |
| 279 | self.formatting = formatting |
| 280 | |
| 281 | def __call__(self, dest: t.Optional[NPath] = None) -> Path: |
| 282 | html, report_id = self._write_html_template( |
| 283 | name=self.name, |
| 284 | formatting=self.formatting, |
| 285 | ) |
| 286 | |
| 287 | index_path = self.app_dir / "index.html" |
| 288 | index_path.write_text(html, encoding="utf-8") |
| 289 | display_msg(f"Built app in {self.app_dir}") |
| 290 | return self.app_dir |
| 291 | |
| 292 | |
| 293 | class ExportHTMLStringInlineAssets(BaseExportHTML): |