当项目与咕噜建Fontawesome不工作 [英] Fontawesome is not working when project is built with grunt

查看:152
本文介绍了当项目与咕噜建Fontawesome不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的字库字体真棒。它的工作原理时,该项目未建/咕噜与变丑。

I'm using the font library font awesome. It works when the project is not built/uglified with grunt.

但是,当我建立了项目,咕噜它不工作。我得到了控制台这个错误:... /字体/ fontawesome-webfont.woff V = 4.0.3 404(未找到)

But when I'm building the project with grunt it's not working. I get this error in console: .../fonts/fontawesome-webfont.woff?v=4.0.3 404 (Not Found)

我用脚手架自耕农项目。

I've scaffolded the project with yeoman.

这是我裁判index.html中

This is my ref in index.html

    <!-- build:css styles/fontawesome.css -->
    <link rel="stylesheet" href="bower_components/font-awesome/css/font-awesome.min.css">
    <!-- endbuild -->

任何想法可能是错的?

Any ideas what can be wrong?

更新
我需要复制的文件夹/ bower_components / FONT-真棒/字体DIST /字体。这需要在繁重的文件工作要做。也许下的复制选项

Update I need to copy the folder /bower_components/font-awesome/fonts to dist/fonts. This needs to be done in the grunt-file. Probably under the "copy" options

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

但我真的不知道在哪里包括这一点。

But I'm not really sure where to include this.

推荐答案

我有同样的问题。下面code解决了我的问题。

I had the same problem. The following code solved my problem.

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/bootstrap/dist', // change this for font-awesome
            src: ['fonts/*.*'],
            dest: '<%= config.dist %>'
        }]
    }
}

这篇关于当项目与咕噜建Fontawesome不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆