ตัวอย่างแบบเรียกไฟล์ทีละไฟล์ ที่ 1
โค้ด: เลือกทั้งหมด
{% stylesheets
'@TestHelloBundle/Resources/public/css/skel-noscript.css'
'@TestHelloBundle/Resources/public/css/style-1000px.css'
'@TestHelloBundle/Resources/public/css/style-desktop.css'
'@TestHelloBundle/Resources/public/css/style-mobile.css'
'@TestHelloBundle/Resources/public/css/style.css'
output="/css/main.css" %}
<link href="{{ asset_url }}" rel="stylesheet" media="screen" />
{% endstylesheets %}
- 2015-04-15_17-53-13.png (50.59 KiB) Viewed 1649 times
ตัวอย่างแบบเรียกไฟล์ทีละไฟล์ที่ 2
โค้ด: เลือกทั้งหมด
{% block stylesheet %}{% stylesheets 'bundles/TestHello/css/*' output="/css/main.css" %}
<link href="{{ asset_url }}" rel="stylesheet" type="text/css" />
{% endstylesheets %}{% endblock %}
- 2015-04-15_17-54-43.png (39.66 KiB) Viewed 1649 times
ตัวอย่างแบบเรียกรวมไฟล์
โค้ด: เลือกทั้งหมด
{% block stylesheet %} {% stylesheets 'bundles/TestHello/css/*' combine=true output="/css/main.css" %}
<link href="{{ asset_url }}" rel="stylesheet" type="text/css" />
{% endstylesheets %}
{% endblock %}{% endblock %}
- 2015-04-15_17-59-24.png (32.06 KiB) Viewed 1649 times
ตัวอย่างแบบ JS
โค้ด: เลือกทั้งหมด
{% block javascript %}
{% javascripts 'bundles/TestHello/js/*' output="/js/main.js" %}
<script src="{{ asset_url }}"></script>
{% endjavascripts %}
{% endblock %}
- 2015-04-15_17-53-47.png (40.6 KiB) Viewed 1649 times
ข้อห้าม! ไม่ควรใส่
filter='cssrewrite' จะทำให้ Error
- 2015-04-15_17-57-21.png (41.51 KiB) Viewed 1649 times