我正在使用一些使用Glyphicons Pro的HTML模板创建我自己的meteor包 为了这个问题,我们将使用"优秀"参考包: jquery-rateit "(http://atmospherejs.com/package/jquery-rateit)并在jquery-rateit包源代码中添加包含Glyphicons Pro图标的HTML模板:
<template name="ratingboard">
<input type="text" id="add-what">
<div class="rateit" id="add-rating"></div>
<button id="add-button">
<span class="glyphicons-icon notes_2"></span>Add rating</button>
<hr/>
{{#if ratingsLoaded}}
<ul>
{{#each ratings}}
<li>{{> rating}}</li>
{{/each}}
</ul>
{{else}}
<img src="http://upload.wikimedia.org/wikipedia/commons/2/2e/24px-spinner-black.gif">
{{/if}}
</template>
<template name="rating">
{{what}} is rated {{rating}}:
<div class="rateit" data-rateit-value="{{rating}}"></div>
</template>
最初我看到&#34; glyphicons-icon notes_2&#34;成功渲染&#34;添加评级&#34;包HTML中的按钮。但这种成功是因为glyphicons文件已经添加到我的流星应用程序中。当我从我的应用程序中删除所有Glyphicons CSS,字体,图像文件和文件夹时,glyphicons不再在jquery-rateit包模板中呈现。
如何将Glyphicons Pro CSS,字体,图像包含在我的Meteor / Atmosphere Package中,以便在安装软件包的任何地方进行渲染?
答案 0 :(得分:0)
我碰巧是jQuery-rateit包的作者。在GitHub上联系我会更快地给你一个答案:)
那就是说,
Glyphicons PRO不是免费的,因此您不应发布重新分发它的Atmosphere软件包。您可以将其包含在一个未公开的私有包中。
查看他们的网站,图标的正确类别为glyphicons glyphicons-notes-2
作为包含字体和CSS的参考,请查看package.js in the official Font Awesome package。关键部分是:
Package.onUse(function (api) {
api.versionsFrom(['METEOR@0.9.2.1', 'METEOR@1.0']);
api.addFiles([
// we bundle all font files, but the client will request only one of them via the CSS @font-face rule
'fonts/fontawesome-webfont.eot', // IE8 or older only understands EOT. IE9+ will read it too because it loads the first occurrence of `src`
'fonts/fontawesome-webfont.svg', // SVG fallback for iOS < 5 - http://caniuse.com/#feat=svg-fonts, http://stackoverflow.com/a/11002874/1269037
'fonts/fontawesome-webfont.ttf', // Android Browers 4.1, 4.3 - http://caniuse.com/#feat=ttf
'fonts/fontawesome-webfont.woff', // Most modern browsers
'css/font-awesome.css'
], where);
});
最后,已经有一个包括Glyphicons halflings的包,官方的Bootstrap包中包含Glyphicons Free。也许有一个你可以随时使用的替代图标?