Including font-size in Angular with grunts

I read a lot about this problem, but still have not found a solution.

I have an Angular app configured with a Johann generator without Sass. I tried to enable fontawesome, so I used bower install components-font-awesome --save.

The problem is that when I have grunt buildmy application, I have an error because the fonts are not found in my dist folder:

GET http://myapp.com/bower_components/components-font-awesome/fonts/fontawesome-webfont.svg?v=4.0.3 404 (Not Found)

So, I tried to add this to the Grunt copy task to copy the fonts to the correct directory:

{
     expand: true,
     cwd: '<%= yeoman.app %>/bower_components/components-font-awesome/fonts/',
     src: ['**'],
     dest: '<%= yeoman.dist %>/bower_components/components-font-awesome/fonts/'
}

But I still get the same error ...

EDIT

Fonts are apparently available in http://myapp.com / dist / bower_components/components-font-awesome/fonts/fontawesome-webfont.svg?v=4.0.3

But not in the URI throwing the error (without / dist) ...

+4
source share
1 answer

, Angular, , fontawesome. , grunt , :

// Copies remaining files to places other tasks can use
        copy: {
            dist: {
                files: [{
                    expand: true,
                    dot: true,
                    cwd: '<%= yeoman.app %>',
                    dest: '<%= yeoman.dist %>',
                    src: [
                        '*.{ico,png,txt}',
                        '.htaccess',
                        '*.html',
                        'views/{,*/}*.html',
                        'bower_components/**/*',
                        'images/{,*/}*.{webp}',
                        'fonts/*'
                    ]
                }, {
                    expand: true,
                    cwd: '.tmp/images',
                    dest: '<%= yeoman.dist %>/images',
                    src: ['generated/*']
                }]
            },
            styles: {
                expand: true,
                cwd: '<%= yeoman.app %>/styles',
                dest: '.tmp/styles/',
                src: '{,*/}*.css'
            }
        },
+1

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


All Articles