i am new to laravel and i just got this html template i am converting to a blade template in my application. However i would like to replace the src and href attributes of all the links and images on the page with the laravel assets function. eg.
Change
<script type="text/javascript" src="js/jquery.js"></script>
to
<script type="text/javascript" src="{{ asset('js/jquery.js') }}"></script>
Unfortunately there are so many of these in my template that i was wondering if there was a way to just do this with regular expressions using the replace tool in my editor.
You can do it using capturing groups.
Go Edit->Find->Replace.. , check Regex
In the first row you should enter:
<script type="text/javascript" src="(.+)"></script>
In the second row:
<script type="text/javascript" src="{{ asset('$1') }}"></script>
With images you can do it similarly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With