Change assets urls to cdn adding absolute path in Grunt

560 views Asked by At

I tried a lot of Grunt plugins. grunt-cdnify, grunt-cdn, and others. All have this same problem. They dont respect the relative path of the url when they add the cdn base url. Basically what i need is that "/page/resources/index.html" assets change from (for example):

<link rel="stylesheet" href="css/resources_style.css">

to:

<link rel="stylesheet" href="//cdn.com/page/resources/css/resources_style.css">

And the same for the sripts and images.

I have a lot of folders like "resources" and every day we add more so i cant just point to each folder in the plugin. I need that it understand the absolute path where the file is for each file.

I also searched for some plugin to just transform relative url's of my assets to absolute ones for then add the cdn but i didnt have any luck.

0

There are 0 answers