Skip to content

Commit 1320b02

Browse files
aktoroubajb
authored andcommitted
Fix for loading js source maps (#20)
1 parent e24dfd9 commit 1320b02

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/Resources/AbstractDispatchableResource.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,18 @@ protected function _processContent()
9595
$map = $this->_filePath . '.map';
9696
if(file_exists($map))
9797
{
98-
$this->_content .= '/*# sourceMappingURL=data:application/json;charset=utf8;base64,'
99-
. base64_encode(file_get_contents($map))
100-
. '*/';
98+
99+
if(strpos($this->_path, '.js') !== false)
100+
{
101+
$this->_content .= PHP_EOL . '//# sourceMappingURL=data:application/json;charset=utf-8;base64,'
102+
. base64_encode(file_get_contents($map));
103+
}
104+
else
105+
{
106+
$this->_content .= '/*# sourceMappingURL=data:application/json;charset=utf8;base64,'
107+
. base64_encode(file_get_contents($map))
108+
. '*/';
109+
}
101110
}
102111
}
103112
}

0 commit comments

Comments
 (0)