mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-08-01 20:22:29 +00:00
fixed bug with config file, when no need to minification
This commit is contained in:
parent
321cf10196
commit
53c416bcf4
4 changed files with 70 additions and 52 deletions
|
|
@ -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){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue