By default canvas gauges delivered with a good level of optimization. Up to your choice you can refer to a minified package which will include only that part you need.
By the way there are possible some tricks to make gauge packages more efficient in terms of disk space usage, or you may need to create your own extended build for some other reasons.
Optimizing Disk Space Usage
This can be critical when the gauges used, for example, with IoT devices, which has limited disk space. Here is a trick how to save up to 3-4 times of overall bytes of canvas gauges.
- Get the required minified code only.
- Gzip it
- Tune web-server do deliver compressed code always.
Possible problem here is that some old browsers may not understand compression. But at present day the impact of this problem is very-very low. Anyway, if you have to support very old browsers, keep it in-mind.
If you choose compressing gauge code outside your build process it can be easily done using canvas-gauges tools.
$ git clone [email protected]:Mikhus/canvas-gauges.git $ npm install $ ./node_modules/.bin/gulp gzip
All minified and compressed packages can be found after that under
dist/ directory. Just grab what you need and remove everything else.
Creating Custom Builds
As far as canvas gauges is an open source you may legally fork and modify it’s code. Tools infrastructure around canvas gauges may help you develop, build test and create production packaging of your changes.
Build process is using gulp as task runner. So there is several tasks which may be helpful when you need to create your custom build: