Replace Discourse's default SVG icons with custom icons in a theme

This does not work. I tried doing a:

<script type="text/discourse-plugin" version="0.8">
    api.replaceIcon("shield-halved", "hat-wizard");
</script>

from here, but it doesn’t seem to work. I think the script tag method is broken, since this doesn’t work with the preview link. Honestly not sure.