【问题标题】:Why does Yeoman build without /styles/fonts?为什么 Yeoman 在没有 /styles/fonts 的情况下构建?
【发布时间】:2013-08-17 15:49:05
【问题描述】:

运行grunt build 后,dist/styles 中没有fonts 目录。 我做错了什么?

这是我在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
            }
        }
    },

【问题讨论】:

  • 不确定你的项目布局,但dist下的fontsDir应该是yeoman.dist而不是yeoman.app
  • 试过了,还是没有字体目录。 dist.options 实际上最初是空的。这只是我,正在尝试的东西。

标签: gruntjs yeoman


【解决方案1】:

compass 任务不负责将字体从app 复制到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/*' // <-- Where fonts are copied.
      ]
    }, {
      expand: true,
      cwd: '.tmp/images',
      dest: '<%= yeoman.dist %>/images',
      src: [
        'generated/*'
      ]
    }]
  }
}

【讨论】:

  • aaaaaaa 并且有效。 :} 它最初没有设置有什么原因吗?
  • 大多数生成器开箱即用。你用的是哪一个?
  • 奇怪的是,骨干生成器。
  • 在找到这个解决方案之前我不知道自己做错了什么
猜你喜欢
  • 1970-01-01
  • 2022-01-24
  • 1970-01-01
  • 2010-11-20
  • 2015-09-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-08-15
相关资源
最近更新 更多