Add a build script for Font Awesome

This commit is contained in:
Jérémie Astori 2016-06-04 16:55:21 -04:00
parent c84cefe1d8
commit c160ba3b84
2 changed files with 31 additions and 1 deletions

View File

@ -14,7 +14,7 @@
"scripts": {
"start": "node index",
"build": "npm run build:font-awesome && npm run build:grunt && npm run build:handlebars",
"build:font-awesome": "mkdir -p client/fonts && cp node_modules/font-awesome/fonts/fontawesome-webfont.* client/fonts",
"build:font-awesome": "node scripts/build-fontawesome.js",
"build:grunt": "grunt",
"build:handlebars": "handlebars client/views/ -e tpl -f client/js/lounge.templates.js",
"test": "(npm run test:mocha || true) && npm run lint",
@ -43,6 +43,7 @@
"commander": "2.9.0",
"event-stream": "3.3.2",
"express": "4.13.4",
"fs-extra": "0.30.0",
"irc-framework": "2.0.0",
"lodash": "4.11.2",
"mkdirp": "0.5.1",

View File

@ -0,0 +1,29 @@
"use strict";
var fs = require("fs-extra");
var srcDir = "./node_modules/font-awesome/fonts/";
var destDir = "./client/fonts/";
var fonts = [
"fontawesome-webfont.eot",
"fontawesome-webfont.svg",
"fontawesome-webfont.ttf",
"fontawesome-webfont.woff",
"fontawesome-webfont.woff2"
];
fs.ensureDir(destDir, function (err) {
if (err) {
console.error(err);
}
fonts.forEach(function (font) {
fs.copy(srcDir + font, destDir + font, function (err) {
if (err) {
console.error(err);
} else {
console.log(font + " successfully installed.");
}
});
});
});