From 6d6f332d53e5f74bc736837f848ccef684a49b0b Mon Sep 17 00:00:00 2001 From: Thomas Jaggi Date: Sun, 2 Aug 2015 20:46:53 +0200 Subject: [PATCH] Update dependencies, tests and docs --- README.md | 5 ++--- package.json | 16 ++++++++++------ test/expected/_icons.css | 10 +++++----- test/expected/_icons.less | 10 +++++----- test/expected/_icons.scss | 10 +++++----- test/main.js | 27 +++++++++++++++++++-------- 6 files changed, 46 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index bea1254..ea47c2d 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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'); @@ -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. - diff --git a/package.json b/package.json index 6407d31..844ec0d 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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" } } diff --git a/test/expected/_icons.css b/test/expected/_icons.css index fede5b2..e78fdf5 100644 --- a/test/expected/_icons.css +++ b/test/expected/_icons.css @@ -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 { diff --git a/test/expected/_icons.less b/test/expected/_icons.less index 9dc03d0..d1ee8e2 100644 --- a/test/expected/_icons.less +++ b/test/expected/_icons.less @@ -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 { diff --git a/test/expected/_icons.scss b/test/expected/_icons.scss index 9fbe64a..5901327 100644 --- a/test/expected/_icons.scss +++ b/test/expected/_icons.scss @@ -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 { diff --git a/test/main.js b/test/main.js index 1eea924..3c9044f 100755 --- a/test/main.js +++ b/test/main.js @@ -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();