From 9b41a0f8b84f22ae80a556a9fb8acc659e44482d Mon Sep 17 00:00:00 2001 From: Dave Kliczbor Date: Sun, 25 Nov 2018 00:32:23 +0100 Subject: [PATCH] Clarified help strings and README --- README.md | 11 +++++++++-- tools/prepare_static_ui_sources.py | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 952483b..8090091 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ Download the [Repository](https://github.com/s00500/ESPUI/archive/master.zip), G ## Getting started -ESPUI serves several Files to the browser to build up its webinterface. This can be achieved in 2 wasy: +ESPUI serves several files to the browser to build up its webinterface. This can be achieved in 2 ways: *PROGMEM* or *SPIFFS* *When `ESPUI.begin()` is called the default is serving files from Memory and ESPUI should work out of the box!* @@ -159,7 +159,14 @@ The library is designed to be easy to use and can still be extended with a lot o # Notes for Development -All changes to the client side files can be made in the `examples/gui/data` directory. Using the file uploader then can be used for development. After this you have to compress them and then you can gzip them. I wrote a little useful jsfiddle for this, [CHECK IT OUT](https://jsfiddle.net/s00500/yvLbhuuv/)... or there is the `prepare_static_ui_sources.py` script in the `tools` directory, if you have a python3 environment available (you also need the modules jsmin, htmlmin and csscompressor). +If you want to work on the HTML/CSS/JS files, do make changes in the `examples/gui/data` directory. When you need to transfer that code to the ESP, run `tools/prepare_static_ui_sources.py -a` (this script needs python3 with the modules htmlmin, jsmin and csscompressor). +This will generate a) minified files next to the original files to be uploaded with the ESP32 sketch data uploader mentioned above and b) the C header files in `src` that contain the minified and gzipped HTML/CSS/JS data (which are used by the **prepareFileSystem** example sketch or when they are served from PROGMEM; see above in the section "Getting started"). +Alternatively, you can duplicate the `examples/gui` directory and work on the copy. Then specify the `--source` and `--target` arguments to the `prepare_static_ui_sources.py` script (run the script without arguments for help). + +If you don't have a python environment, you need to minify and gzip the HTML/CSS/JS files manually. I wrote a little useful jsfiddle for this, [see here](https://jsfiddle.net/s00500/yvLbhuuv/). + +If you change something in HTML/CSS/JS and want to create a pull request, please do include the minified versions and corresponding C header files in your commits. + # Contribute Liked this Library? You can **support** me by sending me a :coffee: [Coffee](https://paypal.me/lukasbachschwell/3). diff --git a/tools/prepare_static_ui_sources.py b/tools/prepare_static_ui_sources.py index dbac7ad..671dd12 100755 --- a/tools/prepare_static_ui_sources.py +++ b/tools/prepare_static_ui_sources.py @@ -27,7 +27,7 @@ def parse_arguments(args=None): parser.add_argument("--target", "-t", dest="target", default=None, help="Target directory containing C header files OR one C header file") parser.add_argument("--nostoremini", "-m", action="store_false", dest="storemini", - help="Do not store intermediate minified (but not gzipped) files next to the originals") + help="Do not store intermediate minified files next to the originals (i.e. only write to the C header files)") args = parser.parse_args(args) if not args.auto and (not args.sources or not args.target): print("ERROR: You need to specify either --auto or both --source and --target\n")