3

我的问题是如何在我的 Grunt 项目中包含 font-awesome?

我的 Gruntfile 中似乎相关的部分是:

        指南针:{
            选项: {
                sassDir: '/样式',
                cssDir: '.tmp/styles',
                imagesDir: '/图像',
                javascriptsDir: '/scripts',
                fontsDir: '/styles/fonts',
                importPath: '/bower_components',
                相对资产:真
            },
            分布:{},
            服务器: {
                选项: {
                    调试信息:真
                }
            }
        },

PS 我看到了: Yeoman,如何引用凉亭包(字体真棒)?--> 他们谈论复制,但不显示 Grunt 代码。

PPS 还有为什么 Yeoman 构建时没有 /styles/fonts?- 但它没有显示如何使用来自 font-awesome 的字体(来自 Bower)

4

2 回答 2

1

您将使用grunt-contrib-copy复制图标库。

首先,您需要使用以下命令加载 grunt-contrib-copy:

grunt.loadNpmTasks('grunt-contrib-copy');

之后,您将使用以下内容创建任务:

grunt.initConfig({
    // ...
    copy: {
        libraries: {
            files: [
                {
                    expand: true,
                    cwd: 'bower_components/fontawesome/fonts/',
                    src: ['**/*'],
                    dest: 'public/fonts/'
                }
            ]
        }
    }
    // ...
});

最后,你需要在默认任务上调用它,如果你使用一个:

grunt.registerTask('default', ['copy:libraries']);
于 2015-07-28T20:37:28.633 回答
-2

这里的答案是@font-face。

这有很大帮助:entypo

此外,pictos.cc 和 fontsquirrel 提供了使用 @font-face 的提示。

于 2013-10-24T20:36:44.067 回答