framework/console/controllers/AssetController.php
public function combineJsFiles($inputFiles, $outputFile)
    {
        $content = '';
        foreach ($inputFiles as $file) {
            // Add a semicolon to source code if trailing semicolon missing.
            // Notice: It needs a new line before `;` to avoid affection of line comment. (// ...;)
            $fileContent = rtrim(file_get_contents($file));
            if (substr($fileContent, -1) !== ';') {
                $fileContent .= "\n;";
            }
            $content .= "/*** BEGIN FILE: $file ***/\n"
                . $fileContent . "\n"
                . "/*** END FILE: $file ***/\n";
        }
        if (!file_put_contents($outputFile, $content)) {
            throw new Exception("Unable to write output JavaScript file '{$outputFile}'.");
        }
    }
public function combineJsFiles($inputFiles, $outputFile)
    {
        $content = '';
        foreach ($inputFiles as $file) {
            // Add a semicolon to source code if trailing semicolon missing.
            // Notice: It needs a new line before `;` to avoid affection of line comment. (// ...;)
            $fileContent = rtrim(file_get_contents($file));
            if (substr($fileContent, -1) !== ';') {
                $fileContent .= "\n;";
            }
            $content .= "/*** BEGIN FILE: $file ***/\n"
                . $fileContent . "\n"
                . "/*** END FILE: $file ***/\n";
        }
        if (!file_put_contents($outputFile, $content)) {
            throw new Exception("Unable to write output JavaScript file '{$outputFile}'.");
        }
    }
public function combineJsFiles ( $ inputFiles , $ outputFile ) { $ content = '' ; foreach ( $ inputFiles as $ file ) { // Add a semicolon to source code if trailing semicolon missing. // Notice: It needs a new line before `;` to avoid affection of line comment. (// ...;) $ fileContent = rtrim ( file_get_contents ( $ file ) ) ; if ( substr ( $ fileContent , - 1 ) !== ';' ) { $ fileContent .= "\n;" ; } $ content .= "/*** BEGIN FILE: $file ***/\n" . $ fileContent . "\n" . "/*** END FILE: $file ***/\n" ; } if ( ! file_put_contents ( $ outputFile , $ content ) ) { throw new Exception ( "Unable to write output JavaScript file '{$outputFile}'." ) ; } }
Combines JavaScript files into a single one.
@param array $inputFiles source file names.
@param string $outputFile output file name.
@throws \yii\console\Exception on failure.
Combines JavaScript files into a single one .