Is there any way to extract the source content of a twig template in an acceptable way? Of course I can use a regex pattern, but I think this is not the best solution.
If I have this:
{% block test %}
This is a test!
{% endblock %}
I want to extract this by using the name of the block:
This is a test!
Suppose file we have file: file.html.twig
with
{% block test %}
This is a test!
{% endblock %}
to extract This is a test!
execute a command:
sed '/{%/ d' file.html.twig
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.