Skip to content

Commit

Permalink
Merge pull request #34 from htanjo/woff2
Browse files Browse the repository at this point in the history
Support WOFF 2.0
  • Loading branch information
backflip committed Mar 10, 2016
2 parents 025dc66 + ef5c823 commit 04494b8
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.DS_Store
node_modules
test/results
test/results*
npm-debug.log
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ gulp.task('iconfont', function(){
});
```

`gulp-iconfont-css` works well with `gulp-iconfont` but you can use it in a more modular fashion by directly using `gulp-svgicons2svgfont`, `gulp-svg2tff`, `gulp-ttf2eot` and/or `gulp-ttf2woff`.
`gulp-iconfont-css` works well with `gulp-iconfont` but you can use it in a more modular fashion by directly using `gulp-svgicons2svgfont`, `gulp-svg2tff`, `gulp-ttf2eot`, `gulp-ttf2woff` and/or `gulp-ttf2woff2`.

## API

Expand Down
1 change: 1 addition & 0 deletions templates/_icons.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
font-family: "<%= fontName %>";
src: url('<%= fontPath %><%= fontName %>.eot');
src: url('<%= fontPath %><%= fontName %>.eot?#iefix') format('eot'),
url('<%= fontPath %><%= fontName %>.woff2') format('woff2'),
url('<%= fontPath %><%= fontName %>.woff') format('woff'),
url('<%= fontPath %><%= fontName %>.ttf') format('truetype'),
url('<%= fontPath %><%= fontName %>.svg#<%= fontName %>') format('svg');
Expand Down
1 change: 1 addition & 0 deletions templates/_icons.less
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
font-family: "<%= fontName %>";
src: url('<%= fontPath %><%= fontName %>.eot');
src: url('<%= fontPath %><%= fontName %>.eot?#iefix') format('eot'),
url('<%= fontPath %><%= fontName %>.woff2') format('woff2'),
url('<%= fontPath %><%= fontName %>.woff') format('woff'),
url('<%= fontPath %><%= fontName %>.ttf') format('truetype'),
url('<%= fontPath %><%= fontName %>.svg#<%= fontName %>') format('svg');
Expand Down
1 change: 1 addition & 0 deletions templates/_icons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
font-family: "<%= fontName %>";
src: url('<%= fontPath %><%= fontName %>.eot');
src: url('<%= fontPath %><%= fontName %>.eot?#iefix') format('eot'),
url('<%= fontPath %><%= fontName %>.woff2') format('woff2'),
url('<%= fontPath %><%= fontName %>.woff') format('woff'),
url('<%= fontPath %><%= fontName %>.ttf') format('truetype'),
url('<%= fontPath %><%= fontName %>.svg#<%= fontName %>') format('svg');
Expand Down
1 change: 1 addition & 0 deletions test/expected/css/_icons.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
font-family: "Icons";
src: url('../fonts/Icons.eot');
src: url('../fonts/Icons.eot?#iefix') format('eot'),
url('../fonts/Icons.woff2') format('woff2'),
url('../fonts/Icons.woff') format('woff'),
url('../fonts/Icons.ttf') format('truetype'),
url('../fonts/Icons.svg#Icons') format('svg');
Expand Down
1 change: 1 addition & 0 deletions test/expected/css/_icons.less
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
font-family: "Icons";
src: url('../fonts/Icons.eot');
src: url('../fonts/Icons.eot?#iefix') format('eot'),
url('../fonts/Icons.woff2') format('woff2'),
url('../fonts/Icons.woff') format('woff'),
url('../fonts/Icons.ttf') format('truetype'),
url('../fonts/Icons.svg#Icons') format('svg');
Expand Down
1 change: 1 addition & 0 deletions test/expected/css/_icons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
font-family: "Icons";
src: url('../fonts/Icons.eot');
src: url('../fonts/Icons.eot?#iefix') format('eot'),
url('../fonts/Icons.woff2') format('woff2'),
url('../fonts/Icons.woff') format('woff'),
url('../fonts/Icons.ttf') format('truetype'),
url('../fonts/Icons.svg#Icons') format('svg');
Expand Down
Binary file modified test/expected/fonts/Icons.woff
Binary file not shown.
Binary file added test/expected/fonts/Icons.woff2
Binary file not shown.
8 changes: 7 additions & 1 deletion test/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('gulp-iconfont-css', function() {
}))
.pipe(iconfont({
fontName: fontName,
formats: ['woff', 'svg'],
formats: ['woff2', 'woff', 'svg'],
timestamp: 1438703262
}))
.pipe(gulp.dest(resultsDir + '/fonts/'))
Expand All @@ -34,6 +34,11 @@ describe('gulp-iconfont-css', function() {
fs.readFileSync(__dirname + '/expected/css/_icons.' + type, 'utf8')
);

assert.equal(
fs.readFileSync(resultsDir + '/fonts/Icons.woff2', 'utf8'),
fs.readFileSync(__dirname + '/expected/fonts/Icons.woff2', 'utf8')
);

assert.equal(
fs.readFileSync(resultsDir + '/fonts/Icons.woff', 'utf8'),
fs.readFileSync(__dirname + '/expected/fonts/Icons.woff', 'utf8')
Expand All @@ -46,6 +51,7 @@ describe('gulp-iconfont-css', function() {

fs.unlinkSync(resultsDir + '/css/_icons.' + type);
fs.rmdirSync(resultsDir + '/css/');
fs.unlinkSync(resultsDir + '/fonts/' + fontName + '.woff2');
fs.unlinkSync(resultsDir + '/fonts/' + fontName + '.woff');
fs.unlinkSync(resultsDir + '/fonts/' + fontName + '.svg');
fs.rmdirSync(resultsDir + '/fonts/');
Expand Down

0 comments on commit 04494b8

Please sign in to comment.