Merge pull request #114 from Gautham/master
Remove unnecessary assets from being copied during Static Page Generatio...
This commit is contained in:
commit
75a7d7579f
@ -513,7 +513,7 @@ function load_tpl_block($file, $options, $base_url){
|
|||||||
return $buffer;
|
return $buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
function copy_recursive($source, $dest){
|
function copy_recursive($source, $dest, $ignoreList = array()){
|
||||||
$src_folder=str_replace(array('.','/'), '', $source);
|
$src_folder=str_replace(array('.','/'), '', $source);
|
||||||
@mkdir($dest.DIRECTORY_SEPARATOR.$src_folder);
|
@mkdir($dest.DIRECTORY_SEPARATOR.$src_folder);
|
||||||
foreach (
|
foreach (
|
||||||
@ -524,7 +524,7 @@ function copy_recursive($source, $dest){
|
|||||||
if ($item->isDir()) {
|
if ($item->isDir()) {
|
||||||
@mkdir($dest . DIRECTORY_SEPARATOR . $src_folder . DIRECTORY_SEPARATOR .$iterator->getSubPathName());
|
@mkdir($dest . DIRECTORY_SEPARATOR . $src_folder . DIRECTORY_SEPARATOR .$iterator->getSubPathName());
|
||||||
} else {
|
} else {
|
||||||
@copy($item, $dest . DIRECTORY_SEPARATOR .$src_folder. DIRECTORY_SEPARATOR .$iterator->getSubPathName());
|
if (!$ignoreList || !in_array($item, $ignoreList)) @copy($item, $dest . DIRECTORY_SEPARATOR .$src_folder. DIRECTORY_SEPARATOR .$iterator->getSubPathName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -551,10 +551,23 @@ function relative_base($count){
|
|||||||
|
|
||||||
function clean_copy_assets($path){
|
function clean_copy_assets($path){
|
||||||
@mkdir($path);
|
@mkdir($path);
|
||||||
|
$options = $GLOBALS["options"];
|
||||||
//Clean
|
//Clean
|
||||||
clean_directory($path);
|
clean_directory($path);
|
||||||
//Copy assets
|
//Copy assets
|
||||||
copy_recursive('./css', $path.'/');
|
$unnecessaryImgs = array('./img/favicon.png', './img/favicon-blue.png', './img/favicon-green.png', './img/favicon-navy.png', './img/favicon-red.png');
|
||||||
copy_recursive('./img', $path.'/');
|
$unnecessaryJs = array();
|
||||||
copy_recursive('./js', $path.'/');
|
if ($options['colors']) {
|
||||||
|
@mkdir($path.'/less');
|
||||||
|
@mkdir($path.'/less/import');
|
||||||
|
@copy('./less/import/daux-base.less', $path.'/less/import/daux-base.less');
|
||||||
|
$unnecessaryImgs = array_diff($unnecessaryImgs, array('./img/favicon.png'));
|
||||||
|
} else {
|
||||||
|
$unnecessaryJs = array('./js/less.min.js');
|
||||||
|
@mkdir($path.'/css');
|
||||||
|
@copy('./css/daux-'.$options['theme'].'.css', $path.'/css/daux-'.$options['theme'].'.css');
|
||||||
|
$unnecessaryImgs = array_diff($unnecessaryImgs, array('./img/favicon-'.$options['theme'].'.png'));
|
||||||
|
}
|
||||||
|
copy_recursive('./img', $path.'/', $unnecessaryImgs);
|
||||||
|
copy_recursive('./js', $path.'/', $unnecessaryJs);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user