2014-02-26 79 views
9

我已经购买了完整的Glyphicons PRO软件包,并且希望将其与Bootstrap 3一起使用。在Bootstrap 3中用Glyphicons PRO替换标准Glyphicons Halflings?

但是,我似乎无法找到有关如何执行此操作的全面文档。该Glyphicons网站缺少“如何使用一节”以及随附的PDF是没有太大的帮助或者 - 这是提的是,不是下载包的一部分glyphicons.css文件...

任何帮助的如何使这个替代非常赞赏。

回答

3

在您的引导文件夹中是一个包含Glyphicons字体的字体文件夹(大部分在CSS文件夹中)。

那些需要用你有的专业版本取代。

接下来,您需要指出(如果字体不具有相同名称)到引导CSS中的新字体。这取决于你使用的是什么技术。

但你必须寻找:

@font-face { 
    font-family: 'Glyphicons Halflings'; 
    src: url('fonts/bootstrap/glyphicons-halflings-regular.eot'); 
    src: url('fonts/bootstrap/glyphicons-halflings-regular.eot?#iefix') format("embedded-opentype"), url('fonts/bootstrap/glyphicons-halflings-regular.woff') format("woff"), url('fonts/bootstrap/glyphicons-halflings-regular.ttf') format("truetype"), url('fonts/bootstrap/glyphicons-halflings-regular.svg#glyphicons-halflingsregular') format("svg"); 
} 

和替换的字体文件名(或者,如果你把他们在另一个地方的位置)

+1

谢谢,我已经尝试过您的建议,但不能得到它的工作。看起来Glyphicons PRO与Halflings相比有另一个CSS语法... – agibsen

+2

那么你需要用专业版 – Mark

+1

中提供的css替换原始的glyphicons font-face一个注意,包含在bootstrap css中的glyphicons有类glyphicon glyphicon - 某些东西,在PRO版本中有glyphicons glyphicons-something(注意s) – eduski

3

正如一些评论上面提到的,他们是与Glyphicons PRO软件包相比,Glyphicons的Bootstrap FREE版本有所不同。

作为一个回顾,这里的主要区别:

  • [差异]:引导的Glyphicons免费] VS [Glyphicons PRO]
  • 图标字体名称“glyphicons-halflings-regular”VS“glyphicons正规”
  • CSS类名“glyphicon”, “glyphicon-” * VS“glyphicon 小号”, “glyphicon 小号 -” *
  • 字体家族“Glyphicons半身人”VS“Glyphicons常规”

鉴于引导的Glyphicons是Glypicons PRO的,你不应该被同时使用,而是代替香草引导的glyphicons.less文件(在引导“少”的文件夹)一个来自PRO软件包。

如果你正在使用JS构建工具,如鲍尔 & 咕噜,你可以有咕噜-contrib请复制任务来自动为你:

copy: { 
server: {    
    files: [{//replace the vanilla Bootstrap's FREE glyphicons.less by the PRO's version 
     expand: true, 
     dot: true, 
     cwd: 'path/to/your/less', //put glyphicons.less (PRO version) here     
     dest:'path/to/bower_components/bootstrap/less', 
     src: 'glyphicons.less' 
    }] 
} 

}

此任务可以在以下地址注册:

grunt.registerTask('serve', [ 
    'copy:server', //replace the vanilla bootstrap's glyphicons 
    // your other tasks here, for eg: 
    // 'less:server', // to compile the less 

    ]); 

并将运行:

grunt serve 
相关问题