I'm using template fragments to build my pages by calling the controllers for each part of the page and adding the result to the final page. This is working.
Now I want to use the same to build my CSS
and js
for each page. This is because I want to be able to manage in the backend how each part looks by changing CSS or calling some specific javascript.
However, for CSS
and JS
, it's returning an encoded version of the templates rather than the templates.
Here's a small sample of what i get from the CSS
:
a.sinf 7b a 9color 3a 23223222 3b a 9text-align3a center 3b a7d
The JS
one comes back with Unicode
encoding on several characters but with an added space (in the form uxxxx).
Does anyone have any ideas on what's wrong? Is it that this can only be used with HTML
controllers? With those, it works fine.
Here's how I call my CSS
controllers in my twig
template:
{{ render(controller('App\Controller\defaultController::indexCss', {data: config})) }}
Where config is an array with the specifics I need to generate my CSS.
question from:
https://stackoverflow.com/questions/65863082/template-fragments-for-css-and-js-return-garbaled-content 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…