Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ggeorgovassilis/gwt-htmlresource
HTML resource generator
https://github.com/ggeorgovassilis/gwt-htmlresource
Last synced: 8 days ago
JSON representation
HTML resource generator
- Host: GitHub
- URL: https://github.com/ggeorgovassilis/gwt-htmlresource
- Owner: ggeorgovassilis
- License: apache-2.0
- Created: 2020-10-07T16:17:13.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-04-01T07:10:10.000Z (7 months ago)
- Last Synced: 2024-04-16T18:11:11.076Z (7 months ago)
- Language: Java
- Size: 58.6 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gwthtmlresource
A HTML resource generator for GWT. License [APL 2](LICENSE)
## What
TL;DR: Works just like `TextResource` but minifies the inlined HTML.
## In detail
GWT resource bundles inline images and textual information into the generated JavaScript deployable. If you need HTML fragments (eg. because you abudantly use `HTMLPanel`s you would normally inject them with a `TextResource` such as:
```javainterface ScreenTemplates extends ClientBundle {
@Source("install-app-prompt.html")
TextResource appInstallPrompt();
...
```
The example above would pick up `install-app-prompt.html`, inline it into the generated `.nocache.js` file(s) and return the html contents when `appInstallPrompt()` is invoked.
If we substitute `TextResource` with `HtmlResource` then the example becomes:
```javainterface ScreenTemplates extends ClientBundle {
@Source("install-app-prompt.html")
HtmlResource appInstallPrompt();
...
```
but the returned HTML content will be minified.# How to use
The artefact isn't available on maven central, so you have to add a repository:
```xml
gwt-sl-mvn-repo
https://raw.github.com/ggeorgovassilis/gwt-htmlresource/mvn-repo/
true
always
```
and then use the dependency```xml
com.georgovassilis
gwt-htmlresource
0.0.2-SNAPSHOT```
## Releases
For GWT prior to 2.11 use 0.0.1-SNAPSHOT
For GWT 2.11 and later use 0.0.2-SNAPSHOT
## Credits
This code is based on the TextResource and TextResourceGenerator classes of the [GWT project](http://www.gwtproject.org/)