Skip to content

Commit

Permalink
Fix for loading js source maps (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
aktorou authored and bajb committed Oct 10, 2019
1 parent e24dfd9 commit 1320b02
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/Resources/AbstractDispatchableResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,18 @@ protected function _processContent()
$map = $this->_filePath . '.map';
if(file_exists($map))
{
$this->_content .= '/*# sourceMappingURL=data:application/json;charset=utf8;base64,'
. base64_encode(file_get_contents($map))
. '*/';

if(strpos($this->_path, '.js') !== false)
{
$this->_content .= PHP_EOL . '//# sourceMappingURL=data:application/json;charset=utf-8;base64,'
. base64_encode(file_get_contents($map));
}
else
{
$this->_content .= '/*# sourceMappingURL=data:application/json;charset=utf8;base64,'
. base64_encode(file_get_contents($map))
. '*/';
}
}
}
}
Expand Down

0 comments on commit 1320b02

Please sign in to comment.