Where should I save my css and js files in Symfony project?

大憨熊 提交于 2019-12-11 13:50:12

问题


The docs seem unclear.I am not sure if I have to rewrite rules with apache so that their folder is staic or something?


回答1:


the documentation is very specific about where to save your javascript & css files

You save them in %SF_ROOT_DIR%/web/css and %SF_ROOT_DIR%/web/js.

You then include them either in the view.yml or you include them manually on each page with use_javascript(''); and use_stylesheet('');




回答2:


Your CSS and JS files are stored in web/css and web/js respectively by default. You can override these but for standard Symfony behaviour, nothing further is needed. You declare the names of the CSS and JS files to be called in the apps/frontend/config/view.yml file (or inside modules' own view.yml files to take advantage of "cascading").



来源:https://stackoverflow.com/questions/5380710/where-should-i-save-my-css-and-js-files-in-symfony-project

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!