Sweetalert: A version without inline css

Created on 15 Mar 2018  Â·  2Comments  Â·  Source: t4t5/sweetalert

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.

Most helpful comment

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.

All 2 comments

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

adiwithadidas picture adiwithadidas  Â·  4Comments

girishbr picture girishbr  Â·  5Comments

xgqfrms-GitHub picture xgqfrms-GitHub  Â·  4Comments

daftspunk picture daftspunk  Â·  4Comments

voodoo6 picture voodoo6  Â·  4Comments