z-dom-config
This module helps loading JSON configuration from data-*
attributes.
Since it's a CommonJS module, it must be used alongside with Browserify, or something similar, like WebPacker.
Example, explanation
<!-- The DOM element we want to extract the configuration from -->
var dom_config = ; // Loads and parses the "data-configuration" attribute, then deep-merges the// results with the object given as the default configuration if given.// Note: If the string is not a valid JSON string, then a console error is shown// and an empty object will be used instead of the attribute's contents.dom_config;// -> {bool_value: false, something_else: 42}