sweetalert icon indicating copy to clipboard operation
sweetalert copied to clipboard

A version without inline css

Open czirkoszoltan opened this issue 7 years ago • 2 comments

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.

czirkoszoltan avatar Mar 15 '18 07:03 czirkoszoltan

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.

t4t5 avatar Mar 26 '18 10:03 t4t5

@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.

mateo9 avatar Sep 25 '20 20:09 mateo9