javascript - Symfony CMF CSS 未加载 : Resource interpreted as Stylesheet but transferred with MIME type text/html:

标签 javascript php css symfony symfony-cmf

使用这个 tutorial ,我正在尝试启动并运行 Symfony2 CMF。我能够启动框架,但没有加载任何样式或脚本。我收到 js 和 css 的错误:

Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://cmf.local/app_dev.php/css/3428277_bootstrap.min_1.css". en:14
Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://cmf.local/app_dev.php/css/06935bc_font-awesome_3.css". en:32
Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://cmf.local/app_dev.php/css/3428277_style_3.css". en:28
Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://cmf.local/app_dev.php/css/06935bc_create-ui_2.css". en:31
Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://cmf.local/app_dev.php/css/06935bc_tags_1.css". en:30
Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://cmf.local/app_dev.php/css/3428277_bootstrap-responsive.min_2.css". en:21
Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://cmf.local/app_dev.php/css/06935bc_overlay_7.css". en:36
Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://cmf.local/app_dev.php/css/06935bc_createStyle_6.css". en:35
Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://cmf.local/app_dev.php/css/06935bc_midgardnotif_4.css". en:33
Resource interpreted as Script but transferred with MIME type text/html: "http://cmf.local/app_dev.php/js/create_jquery_1.js". en:283
Resource interpreted as Script but transferred with MIME type text/html: "http://cmf.local/app_dev.php/js/create_jquery-ui_2.js". en:284
Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://cmf.local/app_dev.php/css/06935bc_halloCmfStyle_5.css". en:34
Resource interpreted as Script but transferred with MIME type text/html: "http://cmf.local/app_dev.php/js/create_underscore_3.js". en:285
Resource interpreted as Script but transferred with MIME type text/html: "http://cmf.local/app_dev.php/js/create_rangy-core_5.js". en:287
Resource interpreted as Script but transferred with MIME type text/html: "http://cmf.local/app_dev.php/js/create_vie_6.js". en:288
Resource interpreted as Script but transferred with MIME type text/html: "http://cmf.local/app_dev.php/js/create_backbone_4.js". en:286
Resource interpreted as Script but transferred with MIME type text/html: "http://cmf.local/app_dev.php/js/create_jquery.rdfquery.core_7.js". en:289
Resource interpreted as Script but transferred with MIME type text/html: "http://cmf.local/app_dev.php/js/create_jquery.rdfquery.rules_8.js". en:290
Resource interpreted as Script but transferred with MIME type text/html: "http://cmf.local/app_dev.php/js/create_annotate_10.js". en:292
Resource interpreted as Script but transferred with MIME type text/html: "http://cmf.local/app_dev.php/js/create_create_11.js". en:293
Resource interpreted as Script but transferred with MIME type text/html: "http://cmf.local/app_dev.php/js/create_jquery.tagsinput_9.js". en:291
Resource interpreted as Script but transferred with MIME type text/html: "http://cmf.local/app_dev.php/js/ckeditor_ckeditor_1.js". en:297
Resource interpreted as Script but transferred with MIME type text/html: "http://cmf.local/app_dev.php/js/ckeditor_init-create-ckeditor_2.js". en:298
Resource interpreted as Script but transferred with MIME type text/html: "http://cmf.local/app_dev.php/js/ckeditor_init-create-common_3.js". 

这些样式和脚本是从 skeleton.html.twig:

加载的
{% stylesheets
    ...             
    <link rel="stylesheet" href="{{ asset_url }}" media="screen" type="text/css"/>
 {% endstylesheets %}

{% block bottom_scripts %}
            {% render(controller("cmf_create.jsloader.controller:includeJSFilesAction", { "editor": "ckeditor", "_locale": app.request.locale })) %}
{% endblock %}

根据教程,这些样式应该可以正常加载。我还使用了 CMF 文档 here ,并且可以加载样式,但遇到了文档的许多其他问题。有什么我需要在我的 config.yml 中调整的吗?

更新

这似乎是 assetic 的问题。如果我手动将样式加载到 skeleton.html.twig 中,它们就会出现。

为什么 assetic 会导致这种 mime 类型转移?在这个庞大的框架中我没有正确的某些设置?

最佳答案

尝试转储 Assets :

$  app/console assetic:dump


09:27:19 [file+] /var/www/app/../web/css/06935bc.css
09:27:19 [file+] /var/www/app/../web/css/06935bc_tags_1.css
09:27:19 [file+] /var/www/app/../web/css/06935bc_create-ui_2.css
09:27:19 [file+] /var/www/app/../web/css/06935bc_font-awesome_3.css
09:27:19 [file+] /var/www/app/../web/css/06935bc_midgardnotif_4.css
09:27:19 [file+] /var/www/app/../web/css/06935bc_halloCmfStyle_5.css
09:27:19 [file+] /var/www/app/../web/css/06935bc_createStyle_6.css
09:27:19 [file+] /var/www/app/../web/css/06935bc_overlay_7.css
09:27:19 [file+] /var/www/app/../web/js/ckeditor.js
09:27:19 [file+] /var/www/app/../web/js/ckeditor_ckeditor_1.js
09:27:19 [file+] /var/www/app/../web/js/ckeditor_init-create-ckeditor_2.js
09:27:19 [file+] /var/www/app/../web/js/ckeditor_init-create-common_3.js
09:27:19 [file+] /var/www/app/../web/js/create.js
09:27:19 [file+] /var/www/app/../web/js/create_jquery_1.js
09:27:19 [file+] /var/www/app/../web/js/create_jquery-ui_2.js
09:27:19 [file+] /var/www/app/../web/js/create_underscore_3.js
09:27:19 [file+] /var/www/app/../web/js/create_backbone_4.js
09:27:19 [file+] /var/www/app/../web/js/create_rangy-core_5.js
09:27:19 [file+] /var/www/app/../web/js/create_vie_6.js
09:27:19 [file+] /var/www/app/../web/js/create_jquery.rdfquery.core_7.js
09:27:19 [file+] /var/www/app/../web/js/create_jquery.rdfquery.rules_8.js
09:27:19 [file+] /var/www/app/../web/js/create_jquery.tagsinput_9.js
09:27:19 [file+] /var/www/app/../web/js/create_annotate_10.js
09:27:19 [file+] /var/www/app/../web/js/create_create_11.js
09:27:19 [file+] /var/www/app/../web/js/hallo-extra.js
09:27:19 [file+] /var/www/app/../web/js/hallo-extra_jquery.htmlClean_1.js
09:27:19 [file+] /var/www/app/../web/js/hallo-extra_hallo_2.js
09:27:19 [file+] /var/www/app/../web/js/hallo-extra_init-create-hallo_3.js
09:27:19 [file+] /var/www/app/../web/js/hallo-extra_init-create-common_4.js

关于javascript - Symfony CMF CSS 未加载 : Resource interpreted as Stylesheet but transferred with MIME type text/html:,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21141753/

相关文章:

javascript - HTML 表单中的输入阻碍

javascript - JQuery语法困惑

javascript - Firefox WebExtension - chrome.tabs.query

PHP : Best way to call an object method from another object ?

html - 错误的 css 样式

javascript - JS 中的 flex 滚动和菜单栏错误

PHP 从数据库中获取数据

php - jquery 悬停有效,onclick 无效

html - float :left insive li in Chrome

css - 如何确保我的 HTML 登录页面在我的 iPad webview 中具有相同的纵向和横向布局?