Skip to content
This repository has been archived by the owner on Oct 28, 2022. It is now read-only.

Commit

Permalink
formatOptions option added. Fixes #10 - hopefuly. Thanks to @mrbar42
Browse files Browse the repository at this point in the history
  • Loading branch information
Ingwie Phoenix committed Mar 26, 2016
1 parent 4cfd777 commit c01fc25
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
24 changes: 15 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ function getFilesAndDeps(patterns, context) {

var globDirs = glob.sync(path.dirname(globExp) + '/', globOptions);
directoryDeps = directoryDeps.concat(globDirs.map(absolute(context)));


}

// Re-work the files array.
Expand All @@ -58,7 +56,6 @@ function getFilesAndDeps(patterns, context) {
files: filesDeps
}
};

}

module.exports = function (content) {
Expand Down Expand Up @@ -102,19 +99,28 @@ module.exports = function (content) {
baseClass: config.baseClass || "icon",
classPrefix: "classPrefix" in config ? config.classPrefix : "icon-"
},
rename: (typeof config.rename == "function" ? config.rename : function (f) {
return path.basename(f, ".svg");
}),
dest: "",
writeFiles: false
writeFiles: false,
formatOptions: config.formatOptions || {}
};

// This originally was in the object notation itself.
// Unfortunately that actually broke my editor's syntax-highlighting...
// ... what a shame.
if(typeof config.rename == "function") {
fontconf.rename = config.rename;
} else {
fontconf.rename = function(f) {
return path.basename(f, ".svg");
}
}

if (config.cssTemplate) {
fontconf.cssTemplate = absolute(this.context, config.cssTemplate);
}

for (var option in config.templateOptions) {
if (config.templateOptions.hasOwnProperty(option)) {
for(var option in config.templateOptions) {
if(config.templateOptions.hasOwnProperty(option)) {
fontconf.templateOptions[option] = config.templateOptions[option];
}
}
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fontgen-loader",
"version": "0.2.0",
"version": "0.2.1",
"description": "A WebPack loader to automaticaly generate font files and CSS to make your own icon font",
"repository": "DragonsInn/fontgen-loader",
"main": "index.js",
Expand All @@ -21,7 +21,7 @@
"license": "MIT",
"dependencies": {
"loader-utils": "^0.2.10",
"webfonts-generator": "^0.3.0",
"webfonts-generator": "^0.3.2",
"glob": "^6.0.2"
},
"devDependencies": {
Expand Down

0 comments on commit c01fc25

Please sign in to comment.