Search code examples
laravelnpmlaravel-5.4glyphicons

Remove Glyphicons from Laravel 5.4


I have project and I want to remove Glyphicons from it. I have tried the following command from my project's root folder:

npm uninstall glyphicons-halflings

Then I run npm run production. However, there is nothing happened and Glyphicons font remains as it is. How could I remove that font?


Solution

  • Glyphicons is included in bootstrap-sass that is installed through npm. so If you want to remove the glyphicons you would have to remove the require('boostrap-sass') at your bootstrap.js file.

    Or if you really want to remove only the fonts then you remove the

    node_modules/bootstrap-sass/assets/fonts/bootstrap

    directory but this will probably show an error that is glyphicons is not located.

    To fix the error above you should go to

    node_modules/bootstrap-sass/assets/stylesheets/_bootstrap.scss

    file and remove this code

    @import "bootstrap/glyphicons";
    

    The problem with this solution is probably after you have done all those stuffs and you update your dependencies using npm run update then all the things you have deleted will be updated to the latest bootstrap-sass dependency unless you have removed bootstrap-sass dependency in your package.json

    "devDependencies": {
        "bootstrap-sass": "^3.3.7",
      },