yeoman webapp - grunt fontawesome and bootstrap font files copy task
Asked Answered
F

0

6

I have been working around with yeoman and I have generated a webapp with yeoman webapp generator and have added font-awesome and bootstrap-css with bower install. Also I have run grunt bowerInstall to update the index.html file.

Now when I launch the app with grunt serve everything works fine. Just a sample given below screen-grab desired output

But when I do a grunt build and launch it with grunt serve:dist the icons are missing. screen-grab JavaScript errors in console

I understand that the font files are not copied from the error logs in the console. enter image description here Looing into gruntjs file I guess Yeoman generates only tasks to copy the fonts under style/fonts of the app directory and I've to add my own copy task to copy 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,

  1. Why the task to copy bower_component/*/fonts/** to dist directory not included as this looks obvious considering the app fonts are copied using styles/fonts/{,*/}*.*

  2. Is there a Yeoman/grunt specific configuration which can be included to copy this files.(Note: I already have a written a task to copy the font files as below. I would like to know whether there is a alternate way)

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

Thanks in advance.

Figured answered 9/6, 2014 at 15:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.