简体   繁体   中英

Cannot load MDI icons after Grunt build

I've installed LumX via bower and am running on Yeoman angular-generator with grunt.

When running on the development after grunt build, all the icons show up correctly. When I run grunt build and serve the dist/ folder, all the icons sources throw an error via GET: /styles/fonts/ ANY OF THE FONT FILE INCLUDED ?v=1.2.64

I understand everything works on localhost, but can't seem to pinpoint why it keeps referencing that.

I figured that's what the problem is since grunt minifies, but it loads beautifully in development.

Any explanation and solution would be appreciated!

Thanks!

After tinkering around, I found that it was because how Grunt minifies that throws the MaterialDesignIcons off. Since the icon package has a source expecting to find their fonts in a specific path ../style/fonts/* , it won't be the same after a Grunt build since they get minified into a single file.

I took the FontAwesome approach to the Grunt file.

copy: {
  dist: {
    files: [{
      expand: true,
      dot: true,
      cwd: '<%= config.app %>',
      dest: '<%= config.dist %>',
    src: [
      '.{ico,png,txt}',
      '.htaccess',
      'images/{,/}.webp',
      '{,/}.html',
      'styles/fonts/{,/}.'
      ]
     },{
   expand: true,
   dot: true,
   cwd: 'bower_components/mdi/fonts/',
   src: ['.'],
   dest: '<%= yeoman.dist %>/styles/fonts'
  }]
 }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM