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

@ -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){