Why does Yeoman build without glyphicons?

北战南征 提交于 2019-12-03 16:05:49

The bug Sindre mentioned has now been fixed. You can either start a new project with generator-webapp >= 0.4.2 or apply this patch manually, which only involves one new line to the copy task:

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

yeoman 1.1.2 does not seem to work with the answer above.

Change your Gruntfile.js and add:

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/*']
    }, {                                                   <--- add this start
        expand: true,
        cwd: '<%= yeoman.app %>/bower_components/bootstrap/fonts',
        dest: '<%= yeoman.dist %>/fonts',
        src: '*.*'
    }]                                                     <--- end add
  },
  styles: {

Add a new block that copies the fonts out of the bower components into the dist directory. Replace bootstrap with sass-bootstrap if you use the sass distribution.

That's a bug. For now the easiest would be to just copy them manually over to the fonts folder.

Copy fonts from app/bower_components/bootstrap-sass-official/vendor/assets/fonts/bootstrap

To app/fonts

In application.scss change $icon-font-path

From $icon-font-path: "/bower_components/bootstrap-sass-official/vendor/assets/fonts/bootstrap/"

To $icon-font-path: "/fonts/"

cssmin with root option replaces all relative paths.

you can deactivate the root option of cssmin in your Gruntfile.js

cssmin: {
  options: {
    //root: '<%= yeoman.app %>'
  }
},

It worked for me ;)

     copy: {
  dist: {
    files: [{
      expand: true,
      dot: true,
      cwd: '<%= yeoman.app %>',
      dest: '<%= yeoman.dist %>',
      src: [
        '*.{ico,png,txt}',
        '.htaccess',
        '**/*.html',
        'views/**/*.html',
        'images/{,*/}*.{webp}',
        'styles/fonts/{,*/}*.*'
      ]
    }, {
      expand: true,
      cwd: '.tmp/images',
      dest: '<%= yeoman.dist %>/images',
      src: ['generated/*']
    },
        {
        expand: true,
        cwd: '<%= yeoman.app %>/bower_components/bootstrap/fonts',
        dest: '<%= yeoman.dist %>/fonts',
        src: '*.*'
        },
        {
        expand: true,
        cwd: '<%= yeoman.app %>/bower_components/font-awesome/fonts',
        dest: '<%= yeoman.dist %>/fonts',
        src: '*.*'
        }
     /*{
      expand: true,
      cwd: 'bower_components/bootstrap/dist',
      src: 'fonts*//*',
      dest: '<%= yeoman.dist %>'
    }*/]
  },
  styles: {
    expand: true,
    cwd: '<%= yeoman.app %>/styles',
    dest: '.tmp/styles/',
    src: '{,*/}*.css'
  }
},
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!