简体   繁体   English

Symfony4,使用TWIG的原始HTML和CSS

[英]Symfony4 , Raw HTML and CSS using TWIG

I am trying to run a free front-end template on my Symfony4 project, I changed the index.html (of the template) to index.html.php so it can be supported by the the PHP engine of Symfony. 我正在尝试在Symfony4项目上运行免费的前端模板,我将(模板的)index.html更改为index.html.php,以便Symfony的PHP引擎可以支持它。 But it still showing normal text without any style or img. 但是它仍然显示没有任何样式或img的普通文本。 I am not sure if it is a path problem or rendering issue. 我不确定这是路径问题还是渲染问题。 In my index.html.php, I want to refer to my assets directory (which contains the img,css,...etc) which is situated on the same level as my index.html.php, here are the full paths of the subject files and directories: 在我的index.html.php中,我想引用资产目录(包含img,css等),该目录与我的index.html.php位于同一级别,这是主题文件和目录:

myproject/src/Resources/views/test/freeTemplateName/template/index.html.php
myproject/src/Resources/views/test/freeTemplateName/template/assets/.......

I believe you should not have your assets in the src folder, but in the folder public . 我相信您不应在src文件夹中拥有资产,而应在public文件夹中拥有资产。 So for example you could put your css in public/css/myfile.css . 因此,例如,您可以将CSS放在public/css/myfile.css Then refer to that file in your index.html.php like you normally would in your <head> tag. 然后像通常在<head>标记中一样,在index.html.php中引用该文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM