Commit 2bd919c 1 parent 20049c3 commit 2bd919c Copy full SHA for 2bd919c
File tree 4 files changed +90
-1
lines changed
4 files changed +90
-1
lines changed Original file line number Diff line number Diff line change
1
+ var fontName = 'fonterrific' ;
2
+ var fontClass = 'ft' ;
3
+ var fontClassPrefix = 'ft-' ;
4
+
5
+ module . exports = function ( grunt ) {
6
+ grunt . initConfig ( {
7
+ webfont : {
8
+ icons : {
9
+ src : 'icons/svg/*.svg' ,
10
+ dest : 'build/font' ,
11
+ destCss : 'build/' ,
12
+ options : {
13
+ fontBaseName : fontName ,
14
+ fontFilename : fontName ,
15
+ template : 'templates/fonterrific.css' ,
16
+ htmlDemoTemplate : 'templates/fonterrific.html' ,
17
+ templateOptions : {
18
+ fontBaseName : fontName ,
19
+ baseClass : fontClass ,
20
+ classPrefix : fontClassPrefix
21
+ }
22
+ }
23
+ }
24
+ }
25
+ } ) ;
26
+
27
+ grunt . loadNpmTasks ( 'grunt-webfont' ) ;
28
+
29
+ grunt . registerTask ( 'default' , [ 'webfont' ] ) ;
30
+ } ;
Original file line number Diff line number Diff line change 23
23
"bugs" : {
24
24
"url" : " https://github.com/stefanmeschke/fonterrific/issues"
25
25
},
26
- "homepage" : " https://github.com/stefanmeschke/fonterrific#readme"
26
+ "homepage" : " https://github.com/stefanmeschke/fonterrific#readme" ,
27
+ "devDependencies" : {
28
+ "grunt" : " ^1.0.1" ,
29
+ "grunt-webfont" : " ^1.6.0"
30
+ }
27
31
}
Original file line number Diff line number Diff line change
1
+ <% if (fontfaceStyles) { %>
2
+ @font-face {
3
+ font-family : "<%= fontBaseName %>" ;
4
+ <% if (fontSrc1) { %> src: <%= fontSrc1 %> ;<% }%>
5
+ <% if (fontSrc2) { %> src: <%= fontSrc2 %> ;<% }%>
6
+ font- weight: normal;
7
+ font- style: normal;
8
+ }
9
+ <% } %>
10
+
11
+ .<%= baseClass %> {
12
+ dis play: inline-block;
13
+ font- size: inherit;
14
+ font: normal normal normal "<%= fontBaseName %>" ;
15
+ text- rendering: auto ;
16
+ - webkit- font- smoothing: antialiased;
17
+ - moz- osx- font- smoothing: grayscale;
18
+ }
19
+
20
+ <% if (iconsStyles) { %>
21
+ <% for (var glyphIdx = 0; glyphIdx < glyphs.length ; glyphIdx+ + ) { %>
22
+ .<%= classPrefix %> <%= glyphs[glyphIdx ] %> : before { content : "\<%= codepoints[glyphIdx] %>" ; }
23
+ <% } %>
24
+ <% } %>
Original file line number Diff line number Diff line change
1
+ <!doctype html>
2
+ < html >
3
+ < head >
4
+ < meta charset ="utf-8 ">
5
+ < title > Custom template: < %= fontBaseName %> </ title >
6
+ < link rel ="stylesheet " href ="<%= fontBaseName %>.css ">
7
+ </ head >
8
+ < body >
9
+ < h1 > < %= fontBaseName %> </ h1 >
10
+
11
+ < div class ="icons " id ="icons ">
12
+ < % for (var glyphIdx = 0; glyphIdx < glyphs .length; glyphIdx++) { var glyph = glyphs[glyphIdx] % >
13
+ < div data-name ="<%= glyph %> "> < i class ="<%= baseClass %> <%= classPrefix %><%= glyph %> "> </ i > < %= classPrefix %> < %= glyph %> </ div >
14
+ < % } %>
15
+ </ div >
16
+
17
+ < h1 > Usage</ h1 >
18
+ < pre > < code > <i class="< %= baseClass ? baseClass + ' ' : '' %> < %= classPrefix %> < span id ="name "> name</ span > "></i></ code > </ pre >
19
+
20
+ < footer > Generated by < a href ="https://github.com/sapegin/grunt-webfont "> grunt-webfont</ a > .</ footer >
21
+
22
+ < script >
23
+ ( function ( ) {
24
+ document . getElementById ( 'icons' ) . onclick = function ( e ) {
25
+ e = e || window . event ;
26
+ document . getElementById ( 'name' ) . innerHTML = e . target . getAttribute ( 'data-name' ) || e . target . parentNode . getAttribute ( 'data-name' ) ;
27
+ }
28
+ } ) ( ) ;
29
+ </ script >
30
+ </ body >
31
+ </ html >
You can’t perform that action at this time.
0 commit comments