A
A
AlexAll2020-04-22 22:29:05
Yii
AlexAll, 2020-04-22 22:29:05

How to route to js file in yii2?

How to route to js file in yii2?
so that another site can put code like this

<script src="//site.local/gt/LKNFDcwdwl" charset="utf-8" type="text/javascript" async></script>


so that when accessing this path gt / some_hash , the request to the required js file is translated?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2020-04-22
@AlexAll

In the controller, you make an action, register assetsBundle inside it, then get it through the method:
$array = Yii::$app->assetManager->bundles;
Next, process it and return it on request

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question