diff --git a/lib/.jshintrc b/lib/.jshintrc new file mode 100644 index 0000000..42f6123 --- /dev/null +++ b/lib/.jshintrc @@ -0,0 +1,6 @@ +{ + "extends": "../.jshintrc", + "browser": false, + "jquery": false, + "node": true +} diff --git a/lib/npm/postInstall.js b/lib/npm/postInstall.js index d78c5fb..1aaa803 100644 --- a/lib/npm/postInstall.js +++ b/lib/npm/postInstall.js @@ -2,46 +2,48 @@ 'use strict'; var - less = require('less'), + less = require('less'), LessPluginCleanCSS = require('less-plugin-clean-css'), - fs = require('fs-extra'), - path = require('path'), - async = require('async'), - cleanCSSPlugin = new LessPluginCleanCSS({advanced: true, 'clean-css': '-s0'}), - source = '@import "./less/main.less";' - ; + fs = require('fs-extra'), + path = require('path'), + async = require('async'), + cleanCSSPlugin = new LessPluginCleanCSS({advanced: true, 'clean-css': '-s0'}), + source = '@import "./less/main.less";' + ; - const NPM_FONTS_PATH = './node_modules/font-awesome/fonts', - PUBLIC_FONTS_PATH = './public/fonts', - PUBLIC_CSS_PATH = './public/css/main.min.css' - ; + var NPM_FONTS_PATH = './node_modules/font-awesome/fonts', + PUBLIC_FONTS_PATH = './public/fonts', + PUBLIC_CSS_PATH = './public/css/main.min.css' + ; less.render( source, {plugins: [cleanCSSPlugin]}, - (err, output) => { - if (err) throw err; - fs.writeFile( - PUBLIC_CSS_PATH, - output.css, - (err) => { + function(err, output) { if (err) throw err; - console.info('Fichier less/main.less compilé et minifié dans public/css/main.min.css'); - fs.readdir(NPM_FONTS_PATH, (err, files) => { - if(err) throw err; - async.each(files, - (file, next) => fs.copy(path.join(NPM_FONTS_PATH, file), - path.join(PUBLIC_FONTS_PATH, file), - next), - (err) => { + fs.writeFile( + PUBLIC_CSS_PATH, + output.css, + function(err) { if (err) throw err; - console.info('Fichiers de fonts copiés dans ' + PUBLIC_FONTS_PATH); - } - ); - }); + console.info('Fichier less/main.less compilé et minifié dans public/css/main.min.css'); + fs.readdir(NPM_FONTS_PATH, function(err, files) { + if (err) throw err; + async.each(files, + function(file, next) { + fs.copy(path.join(NPM_FONTS_PATH, file), + path.join(PUBLIC_FONTS_PATH, file), + next); + }, + function(err) { + if (err) throw err; + console.info('Fichiers de fonts copiés dans ' + PUBLIC_FONTS_PATH); + } + ); + }); + }); }); - }); }());