Skip to content

Commit

Permalink
Chore: prepare 6.0.4 release.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Krasnoyarov committed Nov 8, 2016
1 parent b7cf5b9 commit f173a06
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 19 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 6.0.4 - 2016-11-08

- Fixed: regression bug with passed arguments to template.

# 6.0.3 - 2016-11-08

- Fixed: validate `xml` of glyphs.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "webfont",
"version": "6.0.3",
"version": "6.0.4",
"description": "Generator of fonts from svg icons, svg icons to svg font, svg font to ttf, ttf to eot, ttf to woff, ttf to woff2",
"license": "MIT",
"author": "itgalaxy <[email protected]>",
Expand Down
40 changes: 32 additions & 8 deletions src/__tests__/standalone-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,28 @@ test('should generated only `woff2` font', (t) => {
});
});

// In future improve css tests on valid based on postcss
test('should generated all fonts with css', (t) => {
t.plan(8);

return standalone({
css: true,
files: `${fixturesPath}/svg-icons/**/*`
}).then((result) => {
t.true(isSvg(result.svg));
t.true(isTtf(result.ttf));
t.true(isEot(result.eot));
t.true(isWoff(result.woff));
t.true(isWoff2(result.woff2));
t.regex(result.css, /\.webfont-avatar/);
t.regex(result.css, /\.webfont-envelope/);
t.regex(result.css, /\.webfont-phone-call/);

return result;
});
});

test('should generated only `woff and `woff2` fonts with css', (t) => {
t.plan(6);
t.plan(8);

return standalone({
css: true,
Expand All @@ -84,33 +102,36 @@ test('should generated only `woff and `woff2` fonts with css', (t) => {
t.true(typeof result.eot === 'undefined');
t.true(isWoff(result.woff));
t.true(isWoff2(result.woff2));
t.true(result.css.length > 0); // eslint-disable-line ava/max-asserts
t.regex(result.css, /\.webfont-avatar/);
t.regex(result.css, /\.webfont-envelope/);
t.regex(result.css, /\.webfont-phone-call/);

return result;
});
});

test('should generated all fonts and css', (t) => {
t.plan(6);
t.plan(8);

return standalone({
css: true,
files: `${fixturesPath}/svg-icons/**/*`
}).then((result) => {
/* eslint-disable ava/max-asserts */
t.true(isSvg(result.svg));
t.true(isTtf(result.ttf));
t.true(isEot(result.eot));
t.true(isWoff(result.woff));
t.true(isWoff2(result.woff2));
t.true(result.css.length > 0); // eslint-disable-line ava/max-asserts
t.regex(result.css, /\.webfont-avatar/);
t.regex(result.css, /\.webfont-envelope/);
t.regex(result.css, /\.webfont-phone-call/);

return result;
});
});

test('should generated all fonts with `css` by passed template', (t) => {
t.plan(6);
t.plan(9);

return standalone({
css: true,
Expand All @@ -122,7 +143,10 @@ test('should generated all fonts with `css` by passed template', (t) => {
t.true(isEot(result.eot));
t.true(isWoff(result.woff));
t.true(isWoff2(result.woff2));
t.is(result.css.slice(0, 21), '/* custom template */');
t.regex(result.css, /\/\*\scustom template\s\*\//);
t.regex(result.css, /\.webfont-avatar/);
t.regex(result.css, /\.webfont-envelope/);
t.regex(result.css, /\.webfont-phone-call/);

return result;
});
Expand Down
16 changes: 6 additions & 10 deletions src/standalone.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ export default function ({
return Promise.reject(new Error('You must pass webfont a `files` glob'));
}

let glyphsData = null;
let glyphsData = [];

return buildConfig({
configFile
Expand Down Expand Up @@ -259,16 +259,12 @@ export default function ({

return Promise.resolve(filteredFiles);
})
.then((foundFiles) => {
glyphsData = getGlyphsData(foundFiles, options);

if (!glyphsData) {
throw new Error('Can\'t get glyphs data');
}
.then((foundFiles) => getGlyphsData(foundFiles, options))
.then((returnedGlyphsData) => {
glyphsData = returnedGlyphsData;

return glyphsData;
return svgIcons2svgFontFn(returnedGlyphsData, options);
})
.then((returnedGlyphsData) => svgIcons2svgFontFn(returnedGlyphsData, options))
.then((result) => svg2ttfFn(result, options.formatsOptions.ttf))
// maybe add ttfautohint
.then((result) => {
Expand Down Expand Up @@ -311,7 +307,7 @@ export default function ({
const nunjucksOptions = merge(
{},
{
glyphsData
glyphs: glyphsData.map((glyphData) => glyphData.metadata)
},
options,
{
Expand Down

0 comments on commit f173a06

Please sign in to comment.