t4t5 / sweetalert

A beautiful replacement for JavaScript's "alert"
https://sweetalert.js.org
MIT License
22.4k stars 2.84k forks source link

A version without inline css #812

Open czirkoszoltan opened 6 years ago

czirkoszoltan commented 6 years ago

Currently the prebuilt version of SweetAlert (from the CDN) also contains the CSS, and injects a style tag in the DOM. It is nice that the library is self-contained, but this prevents using it with a content security policy where 'unsafe-inline' is not enabled for script-src. Also it would be nice to have such a version because it would allow theming the alert more easily; by modifying the CSS rules instead of working around the default ones.

748 is somewhat related.

t4t5 commented 6 years ago

Very good point about the content security policy, which is something that I overlooked.

Maybe we can export the library into two different files – sweetalert.js and sweetalert-unstyled.js? I still like the idea of having the ability to only import a single file to get started, but there should obviously also be an option to manage the styling yourself.

mateo9 commented 3 years ago

@t4t5 Is there any version of SweetAlert from CDN without inline css? I have requirement to remove 'unsafe-inline' from style_src and sweetalert stop working.