Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added fixedCodepoints option to allow specifying codepoints for some … #30

Merged
merged 1 commit into from
Mar 21, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,17 @@ function iconfontCSS(config) {
});
}

currentCodePoint = currentGlyph.toString(16).toUpperCase();
var fileName = path.basename(file.path, '.svg');

if (config.fixedCodepoints && config.fixedCodepoints[fileName]){
currentCodePoint = config.fixedCodepoints[fileName].toString(16).toUpperCase();
} else {
currentCodePoint = (currentGlyph++).toString(16).toUpperCase();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand correctly, this would increase the currentCodePoint value pushed to glyphMap compared to the previous version.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, I've removed counter increase happening several lines later. So currentGlyph gets increased only if there's no fixed codepoint defined for current file.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, was incorrectly assuming that currentCodePoint = (currentGlyph++) would assign the increased value.

}

// Add glyph
glyphMap.push({
fileName: path.basename(file.path, '.svg'),
fileName: fileName,
codePoint: currentCodePoint
});

Expand All @@ -84,9 +90,6 @@ function iconfontCSS(config) {

file.path = path.dirname(file.path) + '/' + inputFilePrefix + path.basename(file.path);

// Increase counter
currentGlyph++;

this.push(file);
cb();
};
Expand Down