fixed bug with config file, when no need to minification

This commit is contained in:
coderaiser 2012-11-14 06:20:49 -05:00
parent 321cf10196
commit 53c416bcf4
4 changed files with 70 additions and 52 deletions

View file

@ -81,6 +81,8 @@ dom.js and util.js.
* Added buttons panel.
* Fixed bug with config file, when no need to minification.
2012.10.01, Version 0.1.7

View file

@ -382,6 +382,7 @@ CloudClient._currentToParent = function(pDirName){
CloudClient.init = function(){
var lFunc = function(){
Util.loadOnLoad([
initCmdButtons,
initModules,
baseInit
]);
@ -426,6 +427,24 @@ function initModules(pCallBack){
});
}
function initCmdButtons(pCallBack){
var lFuncs =[
null,
null, /* f1 */
null, /* f2 */
cloudcmd.view, /* f3 */
cloudcmd.edit, /* f4 */
null, /* f5 */
null, /* f6 */
null, /* f7 */
null, /* f8 */
];
for(var i = 1; i <= 8; i++)
getById('f' + i).onclick = lFuncs[i];
Util.exec(pCallBack);
}
function baseInit(pCallBack){
if(applicationCache){
var lFunc = applicationCache.onupdateready;

View file

@ -2,7 +2,7 @@
"cache" : {"allowed" : false},
"appcache" : false,
"minification" : {
"js" : true,
"js" : false,
"css" : false,
"html" : false,
"img" : false

View file

@ -42,58 +42,55 @@
* если установлены параметры минимизации
*/
doit :(function(){
if(this._allowed.css ||
this._allowed.js ||
this._allowed.html){
var lMinify;
try{
lMinify = require('minify');
}catch(pError){
this._allowed = {js:false,css:false,html:false};
console.log('You coud install minify ' +
'for better download spead:\n' +
'npm i minify');
return this._allowed;
}
/*
* temporary changed dir path,
* becouse directory lib is write
* protected by others by default
* so if node process is started
* from other user (root for example
* in nodester) we can not write
* minified versions
*/
this.MinFolder = '/' + lMinify.MinFolder;
var lOptimizeParams = [];
if (this._allowed.js) {
lOptimizeParams.push('client.js');
}
if (this._allowed.html)
lOptimizeParams.push(this.INDEX);
if (this._allowed.css) {
lOptimizeParams.push({
'./css/style.css' : this._allowed.img
});
lOptimizeParams.push({
'./css/reset.css': this._allowed.img
});
}
if (lOptimizeParams)
lMinify.optimize(lOptimizeParams);
this.Cache = lMinify.Cache;
return this._allowed;
var lMinify = main.require('minify');
if(!lMinify){
this._allowed = {js:false,css:false,html:false};
console.log('You coud install minify ' +
'for better download spead:\n' +
'npm i minify');
return this._allowed;
}
console.log(this._allowed);
/*
* temporary changed dir path,
* becouse directory lib is write
* protected by others by default
* so if node process is started
* from other user (root for example
* in nodester) we can not write
* minified versions
*/
this.MinFolder = '/' + lMinify.MinFolder;
var lOptimizeParams = [];
if (this._allowed.js) {
lOptimizeParams.push('client.js');
}
if (this._allowed.html)
lOptimizeParams.push(this.INDEX);
if (this._allowed.css) {
lOptimizeParams.push({
'./css/style.css' : this._allowed.img
});
lOptimizeParams.push({
'./css/reset.css': this._allowed.img
});
}
if (lOptimizeParams)
lMinify.optimize(lOptimizeParams);
this.Cache = lMinify.Cache;
return this._allowed;
}),
optimize: function(pName, pParams){