Skip to content

Commit

Permalink
Merge pull request #63 from tswestendorp/remove-quotes-vue-related-patch
Browse files Browse the repository at this point in the history
Don't strip quotes around Vue prop values
  • Loading branch information
renatomarinho committed Dec 2, 2017
2 parents 95693a2 + 5708e48 commit cc41940
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/Middleware/RemoveQuotes.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ class RemoveQuotes extends PageSpeed
public function apply($buffer)
{
$replace = [
'/src="(.*?)"/' => 'src=$1',
'/width="(.*?)"/' => 'width=$1',
'/height="(.*?)"/' => 'height=$1',
'/name="(.*?)"/' => 'name=$1',
'/charset="(.*?)"/' => 'charset=$1',
//'/href="(.*?)"/' => 'href=$1',
'/align="(.*?)"/' => 'align=$1',
'/border="(.*?)"/' => 'border=$1',
'/crossorigin="(.*?)"/' => 'crossorigin=$1',
//'/rel="(.*?)"/' => 'rel=$1',
'/type="(.*?)"/' => 'type=$1',
'/ src="(.*?)"/' => ' src=$1',
'/ width="(.*?)"/' => ' width=$1',
'/ height="(.*?)"/' => ' height=$1',
'/ name="(.*?)"/' => ' name=$1',
'/ charset="(.*?)"/' => ' charset=$1',
//'/ href="(.*?)"/' => ' href=$1',
'/ align="(.*?)"/' => ' align=$1',
'/ border="(.*?)"/' => ' border=$1',
'/ crossorigin="(.*?)"/' => ' crossorigin=$1',
//'/ rel="(.*?)"/' => ' rel=$1',
'/ type="(.*?)"/' => ' type=$1',
'/\/>/' => '>',
];

Expand Down
2 changes: 2 additions & 0 deletions tests/Boilerplate/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ <h1>Test Background Image</h1>
<span ng-if="!btnLoading"> ok </span> <span ng-if="btnLoading"> <i class="fa fa-circle-o-notch fa-spin"></i> </span>
</button>

<vue-component :src="'src'" :type="'type'" :width="200"></vue-component>

</form>

<script src="https://github.com/renatomarinho/laravel-page-speed/test/Boilerplate/js/vendor/modernizr-3.5.0.min.js"></script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ public function testRemoveQuotes()
$this->assertContains('<meta name=viewport content="width=device-width, initial-scale=1">', $response->getContent());
$this->assertContains('<img src=http://emblemsbf.com/img/18346.jpg width=250 style="height:300px; padding:10px" >', $response->getContent());
$this->assertContains('<img src=/images/1000coin.png>', $response->getContent());
$this->assertContains('<vue-component :src="\'src\'" :type="\'type\'" :width="200"></vue-component>', $response->getContent());
}
}

0 comments on commit cc41940

Please sign in to comment.