Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Machy8 authored Oct 18, 2017
1 parent 4c0344d commit 075f9ee
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@

```php
$compiler = new GoogleClosureCompiler\Compiler;
$compiled = $compiler->setJsCode($code)->compile();
$response = $compiler->setJsCode($code)->compile();

if ($compiled) {
echo $compiled->getCompiledCode();
if ($response && $response->isWithoutErrors()) {
echo $response->getCompiledCode();

} else {
echo "Error";
echo $code;
}

```
Expand All @@ -52,7 +52,13 @@ public function __construct(Compiler $compiler)
public function renderDefault()
{
$code = file_get_contents('/path/to/script.js');
$this->template->jsCode = $this->compiler->setJsCode($code)->compile();
   $response = $this->compiler->setJsCode($code)->compile();

if ($response && $response->isWithoutErrors()) {
    $code = $response->getCompiledCode();
}

  $this->template->jsCode = $code;
}
```

Expand Down

0 comments on commit 075f9ee

Please sign in to comment.