Search code examples
csswebpackfontssemantic-ui

Removing data:application/x-font-ttf and data:application/font-woff from Semantic-UI CSS?


I'm using React Semantic UI with Webpack, and the context I'm deploying to does not allow self-embedded fonts (data:application/x-font-ttf), but it does allow relative path fonts, which results in the errors:

Refused to load the font 'data:application/x-font-ttf;charset=utf-8;base64[...] because it violates the following Content Security Policy directive: "font-src https://locationofmyapp.com https://fonts.googleapis.com https://fonts.gstatic.com".

What's the quickest/cleanest toolset to use to either totally remove the data:application/font-woff and data:application/x-font-ttf components from the stylesheet?


Solution

  • If anyone else comes across this, the problem is that there's a typo in Semantic-UI.

    Several of the files contain a double semi-colon ;;

    To fix the issue:

    1. Remove every file containing the double semi-colon ;;

      • \node_modules\semantic-ui-css\components\step.min.css

      • \node_modules\semantic-ui-css\components\step.css

      • \node_modules\semantic-ui-css\semantic.min.css

      • \node_modules\semantic-ui-css\semantic.css

    2. Delete the node_modules cache folders:

      • \node_modules\.cache\default-development

      • \node_modules\.cache\babel-loader

    3. Restart the dev server (yarn start or npm start)