开发者

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

开发者 https://www.devze.com 2023-02-18 15:05 出处:网络
The docs seem unclear.I am n开发者_JAVA百科ot sure if I have to rewrite rules with apache so that their folder is staic or something?the documentation is very specific about where to save your javascr

The docs seem unclear.I am n开发者_JAVA百科ot sure if I have to rewrite rules with apache so that their folder is staic or something?


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('');


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").

0

精彩评论

暂无评论...
验证码 换一张
取 消