Skip to content

Commit

Permalink
Bugfix: gulp font-edit on windows (#263)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinchappell authored Oct 1, 2016
1 parent 026f778 commit 0561e05
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
23 changes: 9 additions & 14 deletions gulpfile.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,25 +54,20 @@ var plugins = gulpPlugins(),
* @return {void} logs to terminal.
*/
fontEdit = () => {
let openFont = {
linux: `/opt/google/chrome/google-chrome --enable-plugins ${pkg.config.fontServer}/$(cat .fontello)`,
darwin: `open -a "Google Chrome" ${pkg.config.fontServer}/$(cat .fontello)`,
win32: `start chrome "${pkg.config.fontServer}/$(cat .fontello)"`
};

if (!openFont[platform]) {
return false;
}
let fs = require('fs'),
open = require('opener');

// Connects to font server to get a fresh token for our editing session.
// sends current config in the process.
let getFontToken = `curl --silent --show-error --fail --output .fontello --form "config=@${files.formBuilder.fonts}/config.json" ${pkg.config.fontServer} \n`;

return exec(getFontToken + openFont[platform], function(err, stdout, stderr) {
console.log(stdout);
if (stderr) {
console.error(err, stderr);
}
return fs.readFile('.fontello', function(error, token) {
return exec(getFontToken, function(err, stdout, stderr) {
open(`${pkg.config.fontServer}/${token}`);
if (stderr) {
console.error(err, stderr);
}
});
});
},

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@
"gulp-sourcemaps": "^1.6.0",
"gulp-uglify": "^1.5.3",
"jshint": "^2.9.1",
"jshint-stylish": "^2.1.0"
"jshint-stylish": "^2.1.0",
"opener": "^1.4.2"
},
"engines": {}
}

0 comments on commit 0561e05

Please sign in to comment.