Static website development environment with live reload. Uses Gulp + Browser-Sync + optional Sass
1.7K
A lightweight local development environment for plain HTML, CSS, and JavaScript websites with live reload and Sass support.
Its development static hosting and file-serving architecture are closer to traditional static web servers. Uses Gulp and Browser-Sync
This image is only for local development purposes.
An alternate localhost static development environment using Webpack, also with live-reload, is available at
https://hub.docker.com/r/weaponsforge/livereload-webpackβ
Are you using VSCode and want to do live reload but do not want to run livereload-basic using Docker?
Live Serverβ might be the tool for you. Check it out from from the Visual Studio Marketplace.
GitHub Repository
https://github.com/weaponsforge/livereload-basicβ
Live Preview (Sample Website)
https://weaponsforge.github.io/livereload-basic/β
Pull the "latest" local development image.
docker pull weaponsforge/livereload-basic
Set up local static website development files following the basic project structure. It requires having the static website development HTML, CSS, JavaScript, and optional Sass files inside a FILE_DIRECTORY directory in the host machine. This example uses a FILE_DIRECTORY named "/public", which contains at least:
ββ my-website-project
β ββ .env # optional
β ββ public
β ββββ index.html
β ββββ main.css # optional
β ββββ styles.scss # optional
β ββββ ...
π‘ INFO: To watch file changes for other files besides HTML, CSS, JavaScript and Sass, create a
.envfile in the parent directory ofFILE_DIRECTORY, containing comma-separated values of additional file extensions to watch in theEXTRA_WATCHLISTvariable eg.,EXTRA_WATCHLIST=jpg,png,svg. See Installation - # 3β for more information.
Run the development image.
Navigate to the website project directory (for example, "my-website-project") using a terminal, then run:
# On Linux OS
docker run --rm -p 3000:3000 -v $(pwd)/FILE_DIRECTORY:/opt/app/public weaponsforge/livereload-basic
# On Windows OS (Command Prompt)
docker run --rm -p 3000:3000 -v %cd%\FILE_DIRECTORY:/opt/app/public -e USE_POLLING=true weaponsforge/livereload-basic
TIPS:
FILE_DIRECTORY ("public") with other local directories containing HTML, CSS, and JavaScript files as needed.3000:
PORT environment variable in the command eg., -e PORT=3003-p 3000:3000 with the PORT environment variable eg., -p 3003:3003.# On Linux OS (Bash)
docker run --rm -p 3000:3000 -v $(pwd)/FILE_DIRECTORY:/opt/app/public --env-file ./.env -e USE_POLLING=true weaponsforge/livereload-basic
Alternate (no .env file with EXTRA_WATCHLIST)
# On Linux OS (Bash)
docker run --rm -p 3000:3000 -v $(pwd)/FILE_DIRECTORY:/opt/app/public -e USE_POLLING=true -e EXTRA_WATCHLIST=png,jpg weaponsforge/livereload-basic
Load the localhost website at
http://localhost:3000http://localhost:<NEW_PORT>Edit the local files inside the "/public" directory. Observe their live updates in the localhost web browser.
(Optional) create .scss files in the "/public" directory.
Include the CSS filename of the .scss file you created in the <head> section of index.html.
<!-- CSS file generated from style.scss -->
<link href="style.css" rel="stylesheet" type="text/css">
See B. Editing SASS Files (.scss)β for more information.
Proceed to run and edit SCSS files from Usage - step #3β
Content type
Image
Digest
sha256:8c3d9adfaβ¦
Size
74.4 MB
Last updated
about 1 month ago
docker pull weaponsforge/livereload-basic