Skip to content

Commit

Permalink
fixed regex
Browse files Browse the repository at this point in the history
  • Loading branch information
cbl committed Jun 24, 2020
1 parent 65f1cea commit cd68e92
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions src/Compiler/ScriptCompiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace BladeScript\Compiler;

use Illuminate\Support\Str;
use BladeScript\Contracts\Transpiler;
use Illuminate\Filesystem\Filesystem;
use BladeScript\Engines\MinifierEngine;
Expand Down Expand Up @@ -79,7 +80,7 @@ public function compile($path)
* @param string $script
* @return string
*/
public function compileScript(string $script)
public function compileScript($script)
{
foreach ($this->transpiler as $transpiler) {
$script = $transpiler->transpile($script);
Expand Down Expand Up @@ -109,16 +110,6 @@ public function getRaw($path)
*/
protected function getStyleFromString(string $string)
{
preg_match('/<x-script [^>]*>(.|\n)*?<\/x-script>/', $string, $matches);

if (empty($matches)) {
preg_match('/<x-script>(.|\n)*?<\/x-script>/', $string, $matches);
}

if (empty($matches)) {
return;
}

return preg_replace('/<[^>]*>/', '', $matches[0]);
return Str::between($string, '<x-script>', '</x-script>');
}
}

0 comments on commit cd68e92

Please sign in to comment.