Skip to content
This repository has been archived by the owner on Feb 1, 2023. It is now read-only.

Commit

Permalink
Merge pull request #10 from shaffe-fr/patch-1
Browse files Browse the repository at this point in the history
Fix JavaScript error on combined files by adding a semicolon at the end of every combined JavaScript file.
  • Loading branch information
tonydewan committed Nov 11, 2014
2 parents c08aefe + ab102c0 commit 21fa913
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions libraries/carabiner.php
Expand Up @@ -868,23 +868,23 @@ private function _combine($flag, $files, $filename)
{

$file_data = '';


$suffix = $flag == 'js' ? ';' : '';
$path = ($flag == 'css') ? $this->style_path : $this->script_path;
$minify = ($flag == 'css') ? $this->minify_css : $this->minify_js;



foreach($files as $file):

$v = (isset($file['prod']) ) ? 'prod' : 'dev';

if( (isset($file['minify']) && $file['minify'] == true) || (!isset($file['minify']) && $minify) ):

$file_data .= $this->_minify( $flag, $file['dev'] ) . "\n";
$file_data .= rtrim( $this->_minify( $flag, $file['dev'] ), $suffix ) . $suffix ."\n";

else:

$r = ( $this->isURL($file[$v]) ) ? $file[$v] : realpath($path.$file[$v]);
$file_data .= $this->_get_contents( $r ) ."\n";
$file_data .= rtrim( $this->_get_contents( $r ), $suffix ) . $suffix ."\n";

endif;

Expand Down Expand Up @@ -1218,4 +1218,4 @@ public static function isURL($string)
$pattern = '@(((https?|ftp):)?//([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@';
return preg_match($pattern, $string);
}
}
}

0 comments on commit 21fa913

Please sign in to comment.