public function generateAllAssets ($files, $sitePath, $siteName, $isFromVendor)
    {
        $cssMinifier = new Minify\CSS();
        $jsMinifier = new Minify\JS();

        if($isFromVendor){
            $bundleDir = $sitePath.'/public/';
            /**
             * we need to remove the site name on the path
             * since the site name is already included
             * in the file name inside the assets.config
             */
            $sitePath = dirname($sitePath);
        }else{
            $bundleDir = $sitePath.'/'.$siteName.'/public/';
        }

        $messages = array();

        //check if the directory for the bundle is exist
        if($this->checkDir($bundleDir)) {
            //check if bundle is writable
            if (is_writable($bundleDir)) {

                if (!empty($files)) {
                    foreach ($files as $key => $file) {
                        //create a bundle for js
                        $key = strtolower($key);
                        if ($key == 'js') {
                            $messages['error'] = $this->createBundleFile($jsMinifier, 'bundle.js', $file, $sitePath, $bundleDir);
                        }
                        //create a bundle for css
                        if ($key == 'css') {
                            $messages['error'] = $this->createBundleFile($cssMinifier, 'bundle.css', $file, $sitePath, $bundleDir, false);
                        }
                    }
                }
            }else {
                $messages['error'] = array('message' => $bundleDir . ' is not writable.', 'success' => false);
            }
        }else{
            $messages['error'] = array('message' => $bundleDir . ' does not exist.', 'success' => false);
        }
        return $messages;
    }
public function generateAllAssets ($files, $sitePath, $siteName, $isFromVendor)
    {
        $cssMinifier = new Minify\CSS();
        $jsMinifier = new Minify\JS();

        if($isFromVendor){
            $bundleDir = $sitePath.'/public/';
            /**
             * we need to remove the site name on the path
             * since the site name is already included
             * in the file name inside the assets.config
             */
            $sitePath = dirname($sitePath);
        }else{
            $bundleDir = $sitePath.'/'.$siteName.'/public/';
        }

        $messages = array();

        //check if the directory for the bundle is exist
        if($this->checkDir($bundleDir)) {
            //check if bundle is writable
            if (is_writable($bundleDir)) {

                if (!empty($files)) {
                    foreach ($files as $key => $file) {
                        //create a bundle for js
                        $key = strtolower($key);
                        if ($key == 'js') {
                            $messages['error'] = $this->createBundleFile($jsMinifier, 'bundle.js', $file, $sitePath, $bundleDir);
                        }
                        //create a bundle for css
                        if ($key == 'css') {
                            $messages['error'] = $this->createBundleFile($cssMinifier, 'bundle.css', $file, $sitePath, $bundleDir, false);
                        }
                    }
                }
            }else {
                $messages['error'] = array('message' => $bundleDir . ' is not writable.', 'success' => false);
            }
        }else{
            $messages['error'] = array('message' => $bundleDir . ' does not exist.', 'success' => false);
        }
        return $messages;
    }
public function generateAllAssets ( $ files , $ sitePath , $ siteName , $ isFromVendor ) { $ cssMinifier = new Minify \ CSS ( ) ; $ jsMinifier = new Minify \ JS ( ) ; if ( $ isFromVendor ) { $ bundleDir = $ sitePath . '/public/' ; /**
             * we need to remove the site name on the path
             * since the site name is already included
             * in the file name inside the assets.config
             */ $ sitePath = dirname ( $ sitePath ) ; } else { $ bundleDir = $ sitePath . '/' . $ siteName . '/public/' ; } $ messages = array ( ) ; //check if the directory for the bundle is exist if ( $ this -> checkDir ( $ bundleDir ) ) { //check if bundle is writable if ( is_writable ( $ bundleDir ) ) { if ( ! empty ( $ files ) ) { foreach ( $ files as $ key => $ file ) { //create a bundle for js $ key = strtolower ( $ key ) ; if ( $ key == 'js' ) { $ messages [ 'error' ] = $ this -> createBundleFile ( $ jsMinifier , 'bundle.js' , $ file , $ sitePath , $ bundleDir ) ; } //create a bundle for css if ( $ key == 'css' ) { $ messages [ 'error' ] = $ this -> createBundleFile ( $ cssMinifier , 'bundle.css' , $ file , $ sitePath , $ bundleDir , false ) ; } } } } else { $ messages [ 'error' ] = array ( 'message' => $ bundleDir . ' is not writable.' , 'success' => false ) ; } } else { $ messages [ 'error' ] = array ( 'message' => $ bundleDir . ' does not exist.' , 'success' => false ) ; } return $ messages ; }
Function to generate all assets

@param $files
@param $sitePath
@param $siteName
@param $isFromVendor
@return array
Function to generate all assets