I have one request that is I need to change all the css & js path from absolute to relative in page source.

Please refer the screenshot for your easy reference. here I want to change all the css ans js to relative path.

screenshot for your easy reference

For example I need to change

<link  rel="stylesheet" type="text/css"  media="all" href="" />


<link  rel="stylesheet" type="text/css"  media="all" href="/pub/static/frontend/Gworks/Home/en_US/mage/calendar.css" />

how to achieve this?

note : Suppose if this not best practice or not possible, please mention the valid reason in your answers.

  • is this in your theme layout or module? – belfort1 Sep 14 '16 at 13:19
  • @belfort1 I am asking generally, when u see your magento-2 source code (CTRL+U), all the css and js declare with full absolute path I need to change that to relative path. Still you can't get please feel free to mention in comment I will update again. – Bilal Usean Sep 14 '16 at 13:23
  • ok, had misunderstood your question, the urls for css are processed in: Magento\Framework\View\Url\CssResolver – belfort1 Sep 14 '16 at 13:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.