mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-19 01:17:18 +00:00
take avay build in file name parameters in function jsScripts minify module to server.js
This commit is contained in:
parent
d9a0b59730
commit
6dde5720ff
2 changed files with 22 additions and 12 deletions
|
|
@ -48,7 +48,11 @@ var CSSDIR = 'css/';
|
|||
|
||||
exports.MinFolder = MinFolder;
|
||||
|
||||
exports.jsScripts=function jsScripts(){
|
||||
/* function which minificate js-files
|
||||
* @pJSFiles_a - varible, wich contain array
|
||||
* of js file names
|
||||
*/
|
||||
exports.jsScripts=function jsScripts(pJSFiles_a){
|
||||
'use strict';
|
||||
|
||||
/* подключаем модуль uglify-js
|
||||
|
|
@ -67,8 +71,12 @@ exports.jsScripts=function jsScripts(){
|
|||
}
|
||||
/* Константы */
|
||||
var CLIENT_JS='client.js';
|
||||
var CLOUDFUNC_JS='lib/cloudfunc.js';
|
||||
var CLOUDFUNC_JS='lib/cloudfunc.js';
|
||||
var CLIENT_KEYBINDING_JS='lib/client/keyBinding.js';
|
||||
|
||||
pJSFiles_a=['client.js',
|
||||
'lib/cloudfunc.js',
|
||||
'lib/client/keyBinding.js'];
|
||||
|
||||
var dataReaded_f=function(pFileName, pData){
|
||||
console.log('file ' + pFileName + ' readed');
|
||||
|
|
@ -87,6 +95,7 @@ exports.jsScripts=function jsScripts(){
|
|||
var final_code=uglify_js(pData);
|
||||
|
||||
var minFileName=pFileName.replace('.js','.min.js');
|
||||
|
||||
/* если мы сжимаем client.js -
|
||||
* меняем строку cloudfunc.js на
|
||||
* cloudfunc.min.js и выводим сообщение
|
||||
|
|
@ -125,16 +134,13 @@ exports.jsScripts=function jsScripts(){
|
|||
/* записываем сжатый js-скрипт*/
|
||||
fs.writeFile(minFileName, final_code, fileWrited(minFileName));
|
||||
};
|
||||
console.log('reading file ' + CLIENT_JS+'...');
|
||||
fs.readFile(CLIENT_JS,fileReaded(CLIENT_JS,dataReaded_f));
|
||||
|
||||
console.log('reading file ' + CLOUDFUNC_JS+'...');
|
||||
fs.readFile(CLOUDFUNC_JS,fileReaded(CLOUDFUNC_JS,dataReaded_f));
|
||||
|
||||
console.log('reading file ' + CLIENT_KEYBINDING_JS+'...');
|
||||
fs.readFile(CLIENT_KEYBINDING_JS, fileReaded(CLIENT_KEYBINDING_JS,dataReaded_f));
|
||||
|
||||
|
||||
/* moving thru all elements of js files array */
|
||||
for(var i=0;pJSFiles_a[i];i++){
|
||||
console.log('reading file ' + pJSFiles_a[i]+'...');
|
||||
fs.readFile(pJSFiles_a[i],fileReaded(pJSFiles_a[i],dataReaded_f));
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -141,7 +141,11 @@ CloudServer.Minify={
|
|||
this._allowed.html){
|
||||
var lMinify = require(CloudServer.LIBDIRSERVER+'/minify');
|
||||
|
||||
this.done.js=this._allowed.js?lMinify.jsScripts():false;
|
||||
this.done.js=this._allowed.js?lMinify.jsScripts(['client.js',
|
||||
'lib/cloudfunc.js',
|
||||
'lib/client/keyBinding.js'])
|
||||
:false;
|
||||
|
||||
this.done.html=this._allowed.html?lMinify.html():false;
|
||||
this.done.css=this._allowed.css?lMinify.cssStyles(this._allowed.img):false;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue