Skip to content

[Feature Request] Option to disable automatic injection of CSS stylesΒ #158

@tomalexhughes

Description

@tomalexhughes

Currently CSS is injected automatically via a tag inserted into the DOM.

It's also worth noting that the CSS is bundled by default, so there's no need to include any stylesheets to use the default theme. It's dyamically inserted before any other elements (like) stylesheets so it's super easy to override with your own styles.

This can be prevented with an empty link tag in the DOM, like below:

link(rel="stylesheet" id="alertifyCSS")

Whilst this works as expected to me it feels unsemantic to provide an empty link tag that is not actually doing anything.

Instead I think it would be a better option to provide an option to alertify that can prevent this injection from happening without having an empty link tag in the DOM. The benefit of this is that styles can be imported and bundled in the users build process via a module bundler such as Webpack if desired without cluttering the DOM. The link tag would still be the default behaviour unless otherwise specified.

Expected behavior

Link tag is automatically inserted into the DOM by default.
User can specify an option/call a method that prevents this from happening completely.

Actual behavior

Link tag is injected into the DOM unless it already exists.

Steps to reproduce the behavior

Import and run the module.

Version of Alertify in use

1.0.12

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions