Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
86 views
in Technique[技术] by (71.8m points)

javascript - Template fragments for CSS and JS return garbaled content

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.9k users

...