Skip to content

Commit

Permalink
Update dependencies, tests and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
backflip committed Aug 2, 2015
1 parent efc434b commit 6d6f332
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 32 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Warning

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.
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.
The future of this plugin will be discussed in https://github.com/backflip/gulp-iconfont-css/issues/9.

## Usage
Expand All @@ -14,7 +14,7 @@ First, install `gulp-iconfont-css` as a development dependency:
npm install --save-dev gulp-iconfont-css
```

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

```javascript
var iconfont = require('gulp-iconfont');
Expand Down Expand Up @@ -68,4 +68,3 @@ Type: `String`

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

16 changes: 10 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gulp-iconfont-css",
"version": "0.0.9",
"version": "1.0.0",
"description": "Generate (S)CSS file for icon font created with Gulp",
"license": "MIT",
"repository": "backflip/gulp-iconfont-css",
Expand All @@ -21,13 +21,17 @@
"css"
],
"dependencies": {
"gulp-util": "~2.2.0",
"consolidate": "~0.10.0",
"lodash": "~2.4.1"
"gulp-util": "~3.0.6",
"consolidate": "~0.13.1",
"lodash": "~3.10.0"
},
"peerDependencies": {
"gulp-iconfont": "~4.0.0"
},
"devDependencies": {
"mocha": "*",
"event-stream": "~3.1.0",
"gulp": "~3.5.2"
"event-stream": "~3.3.1",
"gulp": "~3.9.0",
"gulp-iconfont": "~4.0.0"
}
}
10 changes: 5 additions & 5 deletions test/expected/_icons.css
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
@font-face {
font-family: "Icons";
src: url('./Icons.eot');
src: url('./Icons.eot?#iefix') format('eot'),
url('./Icons.woff') format('woff'),
url('./Icons.ttf') format('truetype'),
url('./Icons.svg#Icons') format('svg');
src: url('../fonts/Icons.eot');
src: url('../fonts/Icons.eot?#iefix') format('eot'),
url('../fonts/Icons.woff') format('woff'),
url('../fonts/Icons.ttf') format('truetype'),
url('../fonts/Icons.svg#Icons') format('svg');
}

.icon:before {
Expand Down
10 changes: 5 additions & 5 deletions test/expected/_icons.less
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
@font-face {
font-family: "Icons";
src: url('./Icons.eot');
src: url('./Icons.eot?#iefix') format('eot'),
url('./Icons.woff') format('woff'),
url('./Icons.ttf') format('truetype'),
url('./Icons.svg#Icons') format('svg');
src: url('../fonts/Icons.eot');
src: url('../fonts/Icons.eot?#iefix') format('eot'),
url('../fonts/Icons.woff') format('woff'),
url('../fonts/Icons.ttf') format('truetype'),
url('../fonts/Icons.svg#Icons') format('svg');
}

.icon-base-pseudo {
Expand Down
10 changes: 5 additions & 5 deletions test/expected/_icons.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
@font-face {
font-family: "Icons";
src: url('./Icons.eot');
src: url('./Icons.eot?#iefix') format('eot'),
url('./Icons.woff') format('woff'),
url('./Icons.ttf') format('truetype'),
url('./Icons.svg#Icons') format('svg');
src: url('../fonts/Icons.eot');
src: url('../fonts/Icons.eot?#iefix') format('eot'),
url('../fonts/Icons.woff') format('woff'),
url('../fonts/Icons.ttf') format('truetype'),
url('../fonts/Icons.svg#Icons') format('svg');
}

@mixin icon-styles {
Expand Down
27 changes: 19 additions & 8 deletions test/main.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,44 @@
var gulp = require('gulp'),
iconfont = require('gulp-iconfont'),
fs = require('fs'),
es = require('event-stream'),
assert = require('assert'),
iconfontCss = require('../');

describe('gulp-iconfont-css', function() {
var fontName = 'Icons';

function testType(type, name) {
var resultsDir = __dirname + '/results_' + type;

it('should generate ' + name + ' file', function(done) {
gulp.src(__dirname + '/fixtures/icons/*.svg')
.pipe(iconfontCss({
fontName: 'Icons',
fontName: fontName,
path: type,
targetPath: '../_icons.' + type
targetPath: '../css/_icons.' + type,
fontPath: '../fonts/'
}).on('error', function(err) {
console.log(err);
}))
.pipe(gulp.dest(resultsDir + '/icons/'))
.pipe(iconfont({
fontName: fontName,
formats: ['ttf', 'eot', 'woff', 'svg']
}))
.pipe(gulp.dest(resultsDir + '/fonts/'))
.pipe(es.wait(function() {
assert.equal(
fs.readFileSync(resultsDir + '/_icons.' + type, 'utf8'),
fs.readFileSync(resultsDir + '/css/_icons.' + type, 'utf8'),
fs.readFileSync(__dirname + '/expected/_icons.' + type, 'utf8')
);

fs.unlinkSync(resultsDir + '/_icons.' + type);
fs.unlinkSync(resultsDir + '/icons/uE001-github.svg');
fs.unlinkSync(resultsDir + '/icons/uE002-twitter.svg');
fs.rmdirSync(resultsDir + '/icons/');
fs.unlinkSync(resultsDir + '/css/_icons.' + type);
fs.rmdirSync(resultsDir + '/css/');
fs.unlinkSync(resultsDir + '/fonts/' + fontName + '.ttf');
fs.unlinkSync(resultsDir + '/fonts/' + fontName + '.eot');
fs.unlinkSync(resultsDir + '/fonts/' + fontName + '.woff');
fs.unlinkSync(resultsDir + '/fonts/' + fontName + '.svg');
fs.rmdirSync(resultsDir + '/fonts/');
fs.rmdirSync(resultsDir);

done();
Expand Down

0 comments on commit 6d6f332

Please sign in to comment.