Skip to content

Commit 6d6f332

Browse files
committed
Update dependencies, tests and docs
1 parent efc434b commit 6d6f332

File tree

6 files changed

+46
-32
lines changed

6 files changed

+46
-32
lines changed

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
44
## Warning
55

6-
The latest version of [gulp-iconfont](https://github.com/nfroidure/gulp-iconfont) emits a `codepoints` event (see https://github.com/nfroidure/gulp-iconfont/pull/4) which should likely be used instead of the workflow described below. However, it will continue to work as expected.
6+
Recent versions of [gulp-iconfont](https://github.com/nfroidure/gulp-iconfont) emit a `glyphs` event (see [docs](https://github.com/nfroidure/gulp-iconfont/)) which should likely be used instead of the workflow described below. However, it will continue to work as expected.
77
The future of this plugin will be discussed in https://github.com/backflip/gulp-iconfont-css/issues/9.
88

99
## Usage
@@ -14,7 +14,7 @@ First, install `gulp-iconfont-css` as a development dependency:
1414
npm install --save-dev gulp-iconfont-css
1515
```
1616

17-
Then, add it to your `gulpfile.js`:
17+
Then, add it to your `gulpfile.js`. **Important**: It has to be inserted *before* piping the files through `gulp-iconfont`.
1818

1919
```javascript
2020
var iconfont = require('gulp-iconfont');
@@ -68,4 +68,3 @@ Type: `String`
6868

6969
The template engine to use (optional, defaults to ```lodash```).
7070
See https://github.com/visionmedia/consolidate.js/ for available engines. The engine has to be installed before using.
71-

package.json

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gulp-iconfont-css",
3-
"version": "0.0.9",
3+
"version": "1.0.0",
44
"description": "Generate (S)CSS file for icon font created with Gulp",
55
"license": "MIT",
66
"repository": "backflip/gulp-iconfont-css",
@@ -21,13 +21,17 @@
2121
"css"
2222
],
2323
"dependencies": {
24-
"gulp-util": "~2.2.0",
25-
"consolidate": "~0.10.0",
26-
"lodash": "~2.4.1"
24+
"gulp-util": "~3.0.6",
25+
"consolidate": "~0.13.1",
26+
"lodash": "~3.10.0"
27+
},
28+
"peerDependencies": {
29+
"gulp-iconfont": "~4.0.0"
2730
},
2831
"devDependencies": {
2932
"mocha": "*",
30-
"event-stream": "~3.1.0",
31-
"gulp": "~3.5.2"
33+
"event-stream": "~3.3.1",
34+
"gulp": "~3.9.0",
35+
"gulp-iconfont": "~4.0.0"
3236
}
3337
}

test/expected/_icons.css

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
@font-face {
22
font-family: "Icons";
3-
src: url('./Icons.eot');
4-
src: url('./Icons.eot?#iefix') format('eot'),
5-
url('./Icons.woff') format('woff'),
6-
url('./Icons.ttf') format('truetype'),
7-
url('./Icons.svg#Icons') format('svg');
3+
src: url('../fonts/Icons.eot');
4+
src: url('../fonts/Icons.eot?#iefix') format('eot'),
5+
url('../fonts/Icons.woff') format('woff'),
6+
url('../fonts/Icons.ttf') format('truetype'),
7+
url('../fonts/Icons.svg#Icons') format('svg');
88
}
99

1010
.icon:before {

test/expected/_icons.less

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
@font-face {
22
font-family: "Icons";
3-
src: url('./Icons.eot');
4-
src: url('./Icons.eot?#iefix') format('eot'),
5-
url('./Icons.woff') format('woff'),
6-
url('./Icons.ttf') format('truetype'),
7-
url('./Icons.svg#Icons') format('svg');
3+
src: url('../fonts/Icons.eot');
4+
src: url('../fonts/Icons.eot?#iefix') format('eot'),
5+
url('../fonts/Icons.woff') format('woff'),
6+
url('../fonts/Icons.ttf') format('truetype'),
7+
url('../fonts/Icons.svg#Icons') format('svg');
88
}
99

1010
.icon-base-pseudo {

test/expected/_icons.scss

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
@font-face {
22
font-family: "Icons";
3-
src: url('./Icons.eot');
4-
src: url('./Icons.eot?#iefix') format('eot'),
5-
url('./Icons.woff') format('woff'),
6-
url('./Icons.ttf') format('truetype'),
7-
url('./Icons.svg#Icons') format('svg');
3+
src: url('../fonts/Icons.eot');
4+
src: url('../fonts/Icons.eot?#iefix') format('eot'),
5+
url('../fonts/Icons.woff') format('woff'),
6+
url('../fonts/Icons.ttf') format('truetype'),
7+
url('../fonts/Icons.svg#Icons') format('svg');
88
}
99

1010
@mixin icon-styles {

test/main.js

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,44 @@
11
var gulp = require('gulp'),
2+
iconfont = require('gulp-iconfont'),
23
fs = require('fs'),
34
es = require('event-stream'),
45
assert = require('assert'),
56
iconfontCss = require('../');
67

78
describe('gulp-iconfont-css', function() {
9+
var fontName = 'Icons';
10+
811
function testType(type, name) {
912
var resultsDir = __dirname + '/results_' + type;
1013

1114
it('should generate ' + name + ' file', function(done) {
1215
gulp.src(__dirname + '/fixtures/icons/*.svg')
1316
.pipe(iconfontCss({
14-
fontName: 'Icons',
17+
fontName: fontName,
1518
path: type,
16-
targetPath: '../_icons.' + type
19+
targetPath: '../css/_icons.' + type,
20+
fontPath: '../fonts/'
1721
}).on('error', function(err) {
1822
console.log(err);
1923
}))
20-
.pipe(gulp.dest(resultsDir + '/icons/'))
24+
.pipe(iconfont({
25+
fontName: fontName,
26+
formats: ['ttf', 'eot', 'woff', 'svg']
27+
}))
28+
.pipe(gulp.dest(resultsDir + '/fonts/'))
2129
.pipe(es.wait(function() {
2230
assert.equal(
23-
fs.readFileSync(resultsDir + '/_icons.' + type, 'utf8'),
31+
fs.readFileSync(resultsDir + '/css/_icons.' + type, 'utf8'),
2432
fs.readFileSync(__dirname + '/expected/_icons.' + type, 'utf8')
2533
);
2634

27-
fs.unlinkSync(resultsDir + '/_icons.' + type);
28-
fs.unlinkSync(resultsDir + '/icons/uE001-github.svg');
29-
fs.unlinkSync(resultsDir + '/icons/uE002-twitter.svg');
30-
fs.rmdirSync(resultsDir + '/icons/');
35+
fs.unlinkSync(resultsDir + '/css/_icons.' + type);
36+
fs.rmdirSync(resultsDir + '/css/');
37+
fs.unlinkSync(resultsDir + '/fonts/' + fontName + '.ttf');
38+
fs.unlinkSync(resultsDir + '/fonts/' + fontName + '.eot');
39+
fs.unlinkSync(resultsDir + '/fonts/' + fontName + '.woff');
40+
fs.unlinkSync(resultsDir + '/fonts/' + fontName + '.svg');
41+
fs.rmdirSync(resultsDir + '/fonts/');
3142
fs.rmdirSync(resultsDir);
3243

3344
done();

0 commit comments

Comments
 (0)