A
A
Alexander Melnichenko2017-08-02 09:24:00
Yii
Alexander Melnichenko, 2017-08-02 09:24:00

What is the best way to publish static files for multiple projects with shared code?

Yii2 engine.
There is a code on which 2 projects are raised, which differ in design.
What is the best way to implement the separation of statics like sitemap.xml, robots.txt, favicon.ico, google-verification .....
Now this is hung on the controller.
Is it possible to do this by means of the engine, similar to publishing resources.
That is, I register an asset bundle with a bunch of statics (each domain has its own bundle), is it published in the @web directory and everyone is happy?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Timofeev, 2017-08-02
@webinar

It is possible, for this there is an assets manager. Although I'm a little surprised that you called sitemap.xml static. In my understanding, this is a dynamic page.
www.yiiframework.com/doc-2.0/guide-structure-asset...

M
Maxim Fedorov, 2017-08-02
@qonand

There is no way in Yii to specify a separate path for bundle files. All files are copied to the basePath specified in the AssetManager. Accordingly, you need to either write your own AssetManager that implements the necessary functionality or look for a ready-made extension.
But it’s not at all clear why statics should be placed in a bundle and why it can’t be placed immediately in @web

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question