private function js() {
		foreach ($this->localStatic[ __FUNCTION__ ] as $jswip) {
			
			// r.js optimization
			if($this->compress) {
				$rjsBuild = $jswip .DIRECTORY_SEPARATOR. self::RJS_BUILD;
				if(is_file($rjsBuild)) {
					$this	->start('Optimizing '. self::RJS_BUILD .' with r.js')
							->runLocal(['r.js.cmd',
								'-o', $rjsBuild,
							])->finish();

					// temp destination directory
					$jswip .= DIRECTORY_SEPARATOR . 'dist';
					$this->wipe[] = $jswip;
				}
			}
			
			// make file for each sub folder
			foreach (glob($jswip . DIRECTORY_SEPARATOR . '*', GLOB_ONLYDIR) as $v) {
				if ($this->compress) {
					$output = $this->tmp[ __FUNCTION__ ] . basename($v) . '.js';
					self::readyDir($output);

					$this->start('Minifing ' . basename($v) . ' with closure');

					$this->runLocal([self::BIN . 'closure.bat',
						'--language_in', 'ECMASCRIPT5',
						'--js_output_file', $output,
						$v . DIRECTORY_SEPARATOR . '**',
					]);

					$this->finish();
				} else {
					$this->start('Merging ' . basename($v) . '\'s JS files');

					$full = $this->tmp[ __FUNCTION__ ] . basename($v) . '.js';

					//remove compiled file
					if (is_file($full))
						unlink($full);

					// append to new js file
					self::readyDir($full);
					$f = fopen($full, 'a'); //match with $g!
										// get js files
					$g = self::rglob($v . DIRECTORY_SEPARATOR . '*.js');

					// add js files
					foreach ($g as $vv) {
						//$this->start('Adding in '. basename($vv) .' to '. basename($v));
												// start buffer
						ob_start();

						// nice title
						echo "\n\n\n/*** ", basename($vv), " ***/\n\n";

						// output file
						require $vv;

						// save the executed css file
						$file = ob_get_clean();

						// add to file
						fwrite($f, $file);

						//$this->finish();
					}

					fclose($f);
					$this->finish();
				}
			}
		}
		
		return $this;
	}
private function js() {
		foreach ($this->localStatic[ __FUNCTION__ ] as $jswip) {
			
			// r.js optimization
			if($this->compress) {
				$rjsBuild = $jswip .DIRECTORY_SEPARATOR. self::RJS_BUILD;
				if(is_file($rjsBuild)) {
					$this	->start('Optimizing '. self::RJS_BUILD .' with r.js')
							->runLocal(['r.js.cmd',
								'-o', $rjsBuild,
							])->finish();

					// temp destination directory
					$jswip .= DIRECTORY_SEPARATOR . 'dist';
					$this->wipe[] = $jswip;
				}
			}
			
			// make file for each sub folder
			foreach (glob($jswip . DIRECTORY_SEPARATOR . '*', GLOB_ONLYDIR) as $v) {
				if ($this->compress) {
					$output = $this->tmp[ __FUNCTION__ ] . basename($v) . '.js';
					self::readyDir($output);

					$this->start('Minifing ' . basename($v) . ' with closure');

					$this->runLocal([self::BIN . 'closure.bat',
						'--language_in', 'ECMASCRIPT5',
						'--js_output_file', $output,
						$v . DIRECTORY_SEPARATOR . '**',
					]);

					$this->finish();
				} else {
					$this->start('Merging ' . basename($v) . '\'s JS files');

					$full = $this->tmp[ __FUNCTION__ ] . basename($v) . '.js';

					//remove compiled file
					if (is_file($full))
						unlink($full);

					// append to new js file
					self::readyDir($full);
					$f = fopen($full, 'a'); //match with $g!
										// get js files
					$g = self::rglob($v . DIRECTORY_SEPARATOR . '*.js');

					// add js files
					foreach ($g as $vv) {
						//$this->start('Adding in '. basename($vv) .' to '. basename($v));
												// start buffer
						ob_start();

						// nice title
						echo "\n\n\n/*** ", basename($vv), " ***/\n\n";

						// output file
						require $vv;

						// save the executed css file
						$file = ob_get_clean();

						// add to file
						fwrite($f, $file);

						//$this->finish();
					}

					fclose($f);
					$this->finish();
				}
			}
		}
		
		return $this;
	}
private function js ( ) { foreach ( $ this -> localStatic [ __FUNCTION__ ] as $ jswip ) { // r.js optimization if ( $ this -> compress ) { $ rjsBuild = $ jswip . DIRECTORY_SEPARATOR . self :: RJS_BUILD ; if ( is_file ( $ rjsBuild ) ) { $ this -> start ( 'Optimizing ' . self :: RJS_BUILD . ' with r.js' ) -> runLocal ( [ 'r.js.cmd' , '-o' , $ rjsBuild , ] ) -> finish ( ) ; // temp destination directory $ jswip .= DIRECTORY_SEPARATOR . 'dist' ; $ this -> wipe [ ] = $ jswip ; } } // make file for each sub folder foreach ( glob ( $ jswip . DIRECTORY_SEPARATOR . '*' , GLOB_ONLYDIR ) as $ v ) { if ( $ this -> compress ) { $ output = $ this -> tmp [ __FUNCTION__ ] . basename ( $ v ) . '.js' ; self :: readyDir ( $ output ) ; $ this -> start ( 'Minifing ' . basename ( $ v ) . ' with closure' ) ; $ this -> runLocal ( [ self :: BIN . 'closure.bat' , '--language_in' , 'ECMASCRIPT5' , '--js_output_file' , $ output , $ v . DIRECTORY_SEPARATOR . '**' , ] ) ; $ this -> finish ( ) ; } else { $ this -> start ( 'Merging ' . basename ( $ v ) . '\'s JS files' ) ; $ full = $ this -> tmp [ __FUNCTION__ ] . basename ( $ v ) . '.js' ; //remove compiled file if ( is_file ( $ full ) ) unlink ( $ full ) ; // append to new js file self :: readyDir ( $ full ) ; $ f = fopen ( $ full , 'a' ) ; //match with $g! // get js files $ g = self :: rglob ( $ v . DIRECTORY_SEPARATOR . '*.js' ) ; // add js files foreach ( $ g as $ vv ) { //$this->start('Adding in '. basename($vv) .' to '. basename($v)); // start buffer ob_start ( ) ; // nice title echo "\n\n\n/*** " , basename ( $ vv ) , " ***/\n\n" ; // output file require $ vv ; // save the executed css file $ file = ob_get_clean ( ) ; // add to file fwrite ( $ f , $ file ) ; //$this->finish(); } fclose ( $ f ) ; $ this -> finish ( ) ; } } } return $ this ; }
Merges all files
Merges all files