为什么Yeoman没有/样式/字体? [英] Why does Yeoman build without /styles/fonts?

查看:102
本文介绍了为什么Yeoman没有/样式/字体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在运行 grunt build 后,我在 dist /里面没有字体样式
我在做什么错了?



下面是我在 Gruntfile.js 中的内容:


 指南针:{
选项:{
sassDir:'<%= yeoman.app%> / styles',
cssDir:'.tmp / styles',
imagesDir:'<%= yeoman.app%> /../ images',
javascriptsDir:'<%= yeoman.app%> / scripts',
fontsDir:'<%= yeoman.app%> /../ styles / fonts',
importPath: 'app / bower_components',
relativeAssets:true,
},
dist:{
选项:{
imagesDir:'<%= yeoman.dist%> ; / images',
fontsDir:'<%= yeoman.app%> /../ styles / fonts'
}
},
server:{
选项:{
debugInfo:true
}
}
},


解决方案

罗盘任务不负责将字体从应用程序复制到 dist 。这是通过 copy 任务处理的,通常如下所示:

  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 / * '//< - 复制字体的地方。
]
},{
展开:true,
cwd:'.tmp / images',
dest:'<%= yeoman.dist%> / images',
src:[
'generated / *'
]
}]
}
}


After running grunt build I'm left with no fonts directory inside dist/styles. What am I doing wrong?

Here's what I have in the Gruntfile.js:

    compass: {
        options: {
            sassDir: '<%= yeoman.app %>/styles',
            cssDir: '.tmp/styles',
            imagesDir: '<%= yeoman.app %>/../images',
            javascriptsDir: '<%= yeoman.app %>/scripts',
            fontsDir: '<%= yeoman.app %>/../styles/fonts',
            importPath: 'app/bower_components',
            relativeAssets: true,
        },
        dist: {
            options: {
                imagesDir: '<%= yeoman.dist %>/images',
                fontsDir: '<%= yeoman.app %>/../styles/fonts'
            }
        },
        server: {
            options: {
                debugInfo: true
            }
        }
    },

解决方案

The compass task isn't responsible for copying fonts over from app to dist. This is instead handled by the copy task, which usually looks like this:

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/*' // <-- Where fonts are copied.
      ]
    }, {
      expand: true,
      cwd: '.tmp/images',
      dest: '<%= yeoman.dist %>/images',
      src: [
        'generated/*'
      ]
    }]
  }
}

这篇关于为什么Yeoman没有/样式/字体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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