Skip to content

Commit d304be7

Browse files
authored
Adds docs on how to enable Live Reload in a starter app (#252)
* Remove Thymeleaf application properties as they are not needed to use Live Reload * Add docs on how to set up Live Reload * Rearrange docs on when to go to localhost * Add chromium browser list
1 parent 12c24e4 commit d304be7

File tree

3 files changed

+26
-7
lines changed

3 files changed

+26
-7
lines changed

README.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ Table of Contents
1717
* [Actions](#actions)
1818
* [Conditions](#conditions)
1919
* [Setup Instructions](#setup-instructions)
20+
* [Mac and Linux](#mac-and-linux)
21+
* [Windows](#windows)
2022
* [Setup Environment](#setup-environment)
23+
* [IntelliJ](#intellij)
24+
* [Setup Live Reload](#setup-live-reload)
2125
* [Setup Application](#setup-application)
2226
* [Contributing Live Templates to your App](#contributing-live-templates-to-your-app)
2327
* [Using a local version of the Form-Flow Library (For Form-Flow Library Developers)](#using-a-local-version-of-the-form-flow-library-for-form-flow-library-developers)
@@ -141,19 +145,38 @@ After cloning the repository, run `scripts/setup.sh` from the root of the repo's
141145
Check the script `scripts/setup.sh` for the most up to date list of dependencies and steps you'll need to install
142146
manually.
143147

144-
### Setup Environment
148+
## Setup Environment
145149

146150
Note that you'll need to provide some environment variables specified in [sample.env](sample.env) to
147151
your IDE/shell to run the application. We use IntelliJ and have provided setup instructions for
148152
convenience.
149153

150-
#### IntelliJ
154+
### IntelliJ
151155

152156
- `cp sample.env .env` (.env is marked as ignored by git)
153157
- Download the [EnvFile plugin](https://plugins.jetbrains.com/plugin/7861-envfile) and follow the
154158
setup instructions[here](https://github.com/Ashald/EnvFile#usage) to setup Run Configurations with
155159
EnvFile.
156160

161+
#### Setup Live Reload
162+
163+
Live Reload is very helpful when making many changes to HTML templates, CSS, or JavaScript. Here are instructions on how to get IntelliJ to reload resources and have the LiveReload browser extension automatically reload the browser tab for you.
164+
165+
* Download live reload extension in your browser of choice:
166+
* [Firefox extension](https://addons.mozilla.org/en-US/firefox/addon/livereload-web-extension/?utm_source=addons.mozilla.org&utm_medium=referral&utm_content=search)
167+
* [Chrome extension - works with Chrome, Edge, Brave, Arc](https://chromewebstore.google.com/detail/livereload/jnihajbhpnppcggbcgedagnkighmdlei)
168+
* Restart your browser after install
169+
* In IntelliJ, go to Edit configuration
170+
* Modify options
171+
* On Frame deactivation:
172+
* Check - Update classes and resources
173+
* Run your application from IntelliJ
174+
* Go to `http://localhost:8080/`
175+
* Check that the live reload extension is "turned on", it will either be a solid color or a filled dot in the middle of the icon
176+
* Now when you move focus away from IntelliJ it will trigger an update and will then trigger a browser refresh
177+
178+
> 📹 Here's a [video going step by step through these instructions](https://www.loom.com/share/74183c76d45c416e870ccf7aa06dd8ee?sid=a3bf01f9-b22d-423a-b61c-050bb0620d02).
179+
157180
### Setup Application
158181

159182
- Use instructions from

src/main/resources/application.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,11 @@ spring:
6060
- demo
6161
- form-flow-library
6262
thymeleaf:
63-
cache: false
6463
template-resolver-order: 0
6564
check-template-location: true
66-
# TODO: move caching 0 to a dev only context?
6765
web:
6866
resources:
6967
static-locations: file:src/main/resources/static/, file:generated/main/resources/static
70-
cache:
71-
period: 0
7268
datasource:
7369
url: jdbc:postgresql://localhost:5432/starter-app
7470
username: starter-app

src/main/resources/templates/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,4 @@ <h2 th:text="#{index.already-applied-additional}"></h2>
5959
</div>
6060
<th:block th:replace="~{fragments/footer :: footer}"/>
6161
</body>
62-
</html>
62+
</html>

0 commit comments

Comments
 (0)