diff -r 97b805fc88f0 -r fb07469bfb55 src_js/iconolab-bundle/move_dist.js --- a/src_js/iconolab-bundle/move_dist.js Wed Jan 18 16:53:46 2017 +0100 +++ b/src_js/iconolab-bundle/move_dist.js Fri Jan 20 16:46:41 2017 +0100 @@ -6,55 +6,55 @@ const rimraf = require('rimraf') const srcJsPath = path.dirname(__dirname) -const iconolabSrcPath = path.join(srcJsPath,"..","src") -const destJsDir = path.join(iconolabSrcPath, "iconolab", "static","iconolab", "js") -const destCssDir = path.join(iconolabSrcPath,"iconolab", "static","iconolab", "css") +const iconolabSrcPath = path.join(srcJsPath, "..", "src") +const destJsDir = path.join(iconolabSrcPath, "iconolab", "static", "iconolab", "js") +const destCssDir = path.join(iconolabSrcPath, "iconolab", "static", "iconolab", "css") var copyFile = function (src, dest, callback) { - try { - - fs.accessSync(src, fs.R_OK); - fs.accessSync(path.dirname(dest), fs.W_OK); - - // handler error - var errorHandler = function (e) { - callback(e); - } + try { + + fs.accessSync(src, fs.R_OK); + fs.accessSync(path.dirname(dest), fs.W_OK); - var readStream = fs.createReadStream(src); + // handler error + var errorHandler = function (e) { + callback(e); + } - var writeStream = fs.createWriteStream(dest); + var readStream = fs.createReadStream(src); + + var writeStream = fs.createWriteStream(dest); - readStream.on("error", errorHandler); - writeStream.on("error", errorHandler); + readStream.on("error", errorHandler); + writeStream.on("error", errorHandler); - readStream.on("data", function (chunk) { - writeStream.write(chunk); - }); + readStream.on("data", function (chunk) { + writeStream.write(chunk); + }); - readStream.on("end", function () { - writeStream.close(); - }); + readStream.on("end", function () { + writeStream.close(); + }); - } catch (e) { - console.log(e); - if(typeof callback === "function") { - callback(e); - } - } + } catch (e) { + console.log(e); + if (typeof callback === "function") { + callback(e); + } + } } //move js copyFile( - path.join(srcJsPath, "iconolab-bundle", "dist", "iconolab.js"), - path.join(destJsDir, "iconolab.js") - ) + path.join(srcJsPath, "iconolab-bundle", "dist", "iconolab.js"), + path.join(destJsDir, "iconolab.js") +) const bootstrapPath = path.join(srcJsPath, "iconolab-bundle", "node_modules", "bootstrap"); -const fontAwesomeCssPath = path.join(srcJsPath, "iconolab-bundle", "node_modules", "font-awesome","css","font-awesome.min.css"); +const fontAwesomeCssPath = path.join(srcJsPath, "iconolab-bundle", "node_modules", "font-awesome", "css", "font-awesome.min.css"); const fontAwesomeDir = path.join(srcJsPath, "iconolab-bundle", "node_modules", "font-awesome"); //copyFile(bootstrapPath, path.join(destCssDir, "bootstrap.min.css")); @@ -63,34 +63,34 @@ /* boostrap: we copy the dist folder*/ rimraf(path.join(destCssDir, 'bootstrap'), function () { - ncp(path.join(bootstrapPath, "dist"), path.join(destCssDir, "bootstrap"), function (e) { - if (e) { - console.log(e); - console.log("Erreur pendant la copie de boostrap vers le dossier dist"); - } - }); + ncp(path.join(bootstrapPath, "dist"), path.join(destCssDir, "bootstrap"), function (e) { + if (e) { + console.log(e); + console.log("Erreur pendant la copie de boostrap vers le dossier dist"); + } + }); }); /* delete font-awesome folder */ -rimraf(path.join(destCssDir,'font-awesome'), function (e) { - fs.access(path.join(destCssDir,'font-awesome'), fs.F_OK, function (hasError) { - if (hasError) { - fs.mkdir(path.join(destCssDir,'font-awesome'), function (hasError) { - if (!hasError) { - fs.mkdir(path.join(destCssDir,'font-awesome','css'), function (hasError) { - if (!hasError) { - copyFile(fontAwesomeCssPath, path.join(destCssDir, "font-awesome", "css", "font-awesome.min.css")); - ncp(path.join(fontAwesomeDir, "fonts"), path.join(destCssDir, "font-awesome", "fonts")); - } - }) - - } else { - console.log(e); - } - }); - } - }); +rimraf(path.join(destCssDir, 'font-awesome'), function (e) { + fs.access(path.join(destCssDir, 'font-awesome'), fs.F_OK, function (hasError) { + if (hasError) { + fs.mkdir(path.join(destCssDir, 'font-awesome'), function (hasError) { + if (!hasError) { + fs.mkdir(path.join(destCssDir, 'font-awesome', 'css'), function (hasError) { + if (!hasError) { + copyFile(fontAwesomeCssPath, path.join(destCssDir, "font-awesome", "css", "font-awesome.min.css")); + ncp(path.join(fontAwesomeDir, "fonts"), path.join(destCssDir, "font-awesome", "fonts")); + } + }) + + } else { + console.log(e); + } + }); + } + }); });