For some plugins, it can be useful to automatically modify or extend the
TiddlyWeb configuration. This can be achieved using an
init function within the plugin module, which is passed the
config variable.
For example, the following code automatically inserts the necesary configuration for the
CSS serializer:
def init(config):
# automatically extend configuration
content_type = "text/css"
config["extension_types"]["css"] = content_type
config["serializers"][content_type] = [__name__, "text/css; charset=UTF-8"] })
(Note the use of
__name__ to refer to the plugin module itself.)