mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-19 09:24:51 +00:00
moved css file names from minify to server.js
This commit is contained in:
parent
a953623608
commit
d982749fdd
2 changed files with 33 additions and 17 deletions
|
|
@ -15,11 +15,12 @@ var MinFolder='min/';
|
|||
* directory and it is
|
||||
* not exist
|
||||
*/
|
||||
var folderExist = function(pError){
|
||||
var folderExist = function(pError, pStat){
|
||||
"use strict";
|
||||
if(!pError)
|
||||
/*file found and it's directory */
|
||||
if(!pError && pStat.isDirectory())
|
||||
console.log('folder exist: ' + MinFolder);
|
||||
else MinFolder='';
|
||||
else MinFolder='/';
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
@ -29,6 +30,7 @@ var folderExist = function(pError){
|
|||
*/
|
||||
var makeFolder = function(pError){
|
||||
"use strict";
|
||||
/*folder created successfully*/
|
||||
if(!pError)
|
||||
console.log('folder created: min');
|
||||
else fs.stat(MinFolder,folderExist);
|
||||
|
|
@ -145,8 +147,9 @@ exports.jsScripts=function jsScripts(pJSFiles_a){
|
|||
* @pImgConvertToBase64_b - булевый признак,
|
||||
* который отвечает за то, что быконвертировать
|
||||
* картинки в base64 и поместить в выходной css файл
|
||||
* @pCSSFiles_a - масив имен css файлов
|
||||
*/
|
||||
exports.cssStyles=function cssStyles(pImgConvertToBase64_b){
|
||||
exports.cssStyles=function cssStyles(pCSSFiles_a, pImgConvertToBase64_b){
|
||||
'use strict';
|
||||
|
||||
/* connecting cleanCSS,
|
||||
|
|
@ -168,6 +171,8 @@ exports.cssStyles=function cssStyles(pImgConvertToBase64_b){
|
|||
var STYLE_CSS = CSSDIR+'style.css';
|
||||
var RESET_CSS = CSSDIR+'reset.css';
|
||||
|
||||
var pCSSFiles_a=[CSSDIR+'style.css',CSSDIR+'reset.css'];
|
||||
var lReadedStyles=[];
|
||||
var lAllStyle='';
|
||||
var lResetCssDone=false;
|
||||
var lStyleCssDone=false;
|
||||
|
|
@ -208,12 +213,12 @@ exports.cssStyles=function cssStyles(pImgConvertToBase64_b){
|
|||
}
|
||||
};
|
||||
|
||||
console.log('reading file ' + STYLE_CSS+'...');
|
||||
fs.readFile(STYLE_CSS,fileReaded(STYLE_CSS,dataReaded_f));
|
||||
|
||||
console.log('reading file ' + RESET_CSS+'...');
|
||||
fs.readFile(RESET_CSS,fileReaded(RESET_CSS,dataReaded_f));
|
||||
|
||||
/* moving thru all elements of css files array */
|
||||
for(var i=0;pCSSFiles_a[i];i++){
|
||||
console.log('reading file ' + pCSSFiles_a[i]+'...');
|
||||
fs.readFile(pCSSFiles_a[i],fileReaded(pCSSFiles_a[i],dataReaded_f));
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
|
|
|
|||
25
server.js
25
server.js
|
|
@ -61,6 +61,7 @@ var CloudServer={
|
|||
/* name of direcotory with libs */
|
||||
LIBDIR :'./lib',
|
||||
LIBDIRSERVER :'./lib/server',
|
||||
CSSDIR :'./css',
|
||||
|
||||
Port :31337, /* server port */
|
||||
IP :'127.0.0.1'
|
||||
|
|
@ -155,13 +156,19 @@ CloudServer.Minify={
|
|||
this._allowed.html){
|
||||
var lMinify = require(CloudServer.LIBDIRSERVER+'/minify');
|
||||
|
||||
this.done.js=this._allowed.js?lMinify.jsScripts(['client.js',
|
||||
'lib/cloudfunc.js',
|
||||
'lib/client/keyBinding.js'])
|
||||
: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;
|
||||
this.done.html=this._allowed.html?
|
||||
lMinify.html():false;
|
||||
|
||||
this.done.css=this._allowed.css?
|
||||
lMinify.cssStyles([CloudServer.CSSDIR + '/style.css',
|
||||
CloudServer.CSSDIR + '/reset.css'],
|
||||
this._allowed.img):false;
|
||||
|
||||
this.MinFolder=lMinify.MinFolder;
|
||||
}
|
||||
|
|
@ -264,6 +271,10 @@ CloudServer.start=function()
|
|||
CloudServer.IP;
|
||||
|
||||
/* server mode or testing mode */
|
||||
console.log(CloudServer.Config.server);
|
||||
console.log(process.argv[2]);
|
||||
console.log(CloudServer.Config.logs);
|
||||
|
||||
if(CloudServer.Config.server && process.argv[2]!=='test'){
|
||||
var http = require('http');
|
||||
|
||||
|
|
@ -480,7 +491,7 @@ CloudServer._controller=function(pReq, pRes)
|
|||
*/
|
||||
CloudServer.Responses[CloudServer.INDEX]=pRes;
|
||||
|
||||
if(lStat.isDirectory())
|
||||
if(lStat.isDirectory())
|
||||
Fs.readdir(LeftDir,CloudServer._readDir);
|
||||
/* отдаём файл */
|
||||
else if(lStat.isFile()){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue