#631·chartkick

A better way to configure CSP and disable unsafe-inline

Author: elcousCreated Nov 9, 2025Updated Nov 9, 2025

I found a better way to configure CSP that does not require unsafe-inline overwrite

  1. In initializer add a CSS class instead of inline style:
html: '<div id="%<id>s" class="dashboard-chart">%<loading>s</div>'
  1. add your css class (height, alignment font etc)

Works if you can have same style across all charts.