Yoman webapp - copy font-size and bootstrap font file

I work with yoman and I created a webapp with the yeoman webapp generator and added the font-awesome and bootstrap-css with the bower setting. I also ran grunt bowerInstall to update the index.html file.

Now when I run the application with grunt serve , everything works fine. Only sample below screen-grab desired output

But when I make a grunt build and run it with grunt serve:dist , there are no icons. screen-grab JavaScript errors in console

I understand that font files are not copied from error logs in the console. enter image description here Looing to a gruntjs file. I think that Yeoman only generates tasks for copying fonts to the style / fonts of the application directory, and I have to add my own copy task to copy the font files.

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

So the question is:

  • Why the task of copying bower_component / * / fonts / ** to the dist directory is not included, as this seems obvious, given that the application fonts are copied using styles/fonts/{,*/}*.*

  • Is there a specific Yeoman / grunt configuration that can be enabled to copy these files. (Note. I already have a written task to copy the font files as shown below. I would like to know if there is an alternative path)

     { expand: true, dot: true, cwd: '<%= config.bower %>', flatten:true, dest: '<%= config.dist %>/fonts', src: [ '{,*/}/fonts/{,*/}*.*' ] } 

Thanks in advance.

+6
source share

Source: https://habr.com/ru/post/970575/


All Articles