# -*- coding: utf-8 -*-
from ocyan.core.fender import config
from ocyan.core.plugins import OcyanPluginConfig


class UnusedCSSConfig(OcyanPluginConfig):
    def contribute_to_installed_apps(self, installed_apps):
        # it has become extremely unlikely that this plugin will improved the
        # pagespeed in any way. That is why this plugin is made non-functional
        # by default. Should you still be interested in tis plugin's
        # functionality, you can still enable it by defining the below setting
        # in your ocyan.json
        if config.get("unusedcss", "please-slowdown-my-site", False):
            installed_apps.front.append("ocyan.plugin.unusedcss")
            installed_apps.front.register_extension(
                "ocyan.plugin.unusedcss", "ocyan.themes"
            )
            installed_apps.front.register_extension(
                "ocyan.plugin.unusedcss", "ocyan.themes.template9"
            )
        return installed_apps
