]> git.ipfire.org Git - thirdparty/Chart.js.git/commit
Move CSS in a separate file to be CSP-compliant (#6048)
authorSimon Brunel <simonbrunel@users.noreply.github.com>
Fri, 8 Feb 2019 17:17:04 +0000 (18:17 +0100)
committerSimon Brunel <simonbrunel@users.noreply.github.com>
Fri, 8 Feb 2019 18:06:04 +0000 (19:06 +0100)
commit55128f74c1518ac82189c0acba2a6b40f77bf698
treef5fa949ee7eff8839458693818754ebcff43cf63
parentc6c4db79068e70d84f9207d0fb1daed289de6dd2
Move CSS in a separate file to be CSP-compliant (#6048)

In order to be compatible with any CSP, we need to prevent the automatic creation of the DOM 'style' element and offer our CSS as a separate file that can be manually loaded (`Chart.js` or `Chart.min.js`). Users can now opt-out the style injection using `Chart.platform.disableCSSInjection = true` (note that the style sheet is now injected on the first chart creation).

To prevent duplicating and maintaining the same CSS code at different places, move all these rules in `platform.dom.css` and write a minimal rollup plugin to inject that style as string in `platform.dom.js`. Additionally, this plugin extract the imported style in `./dist/Chart.js` and `./dist/Chart.min.js`.
14 files changed:
docs/getting-started/integration.md
gulpfile.js
package.json
rollup.config.js
rollup.plugins.js
samples/advanced/content-security-policy.css [new file with mode: 0644]
samples/advanced/content-security-policy.html [new file with mode: 0644]
samples/advanced/content-security-policy.js [new file with mode: 0644]
samples/samples.js
samples/style.css
scripts/deploy.sh
scripts/release.sh
src/platforms/platform.dom.css [new file with mode: 0644]
src/platforms/platform.dom.js