kaiqigong / gulp-cdnify

A gulp plugin that converts local URLs to CDN ones.
17 stars 9 forks source link

cdnify a background-url in a ng-style #17

Closed Simobain closed 7 years ago

Simobain commented 7 years ago

Hi,

I have a, as showed below a ng-style attribute that changes dynamically a background-img.
image

Gulp-cdnify does not recognize it. What can I do ?

Thanks

kaiqigong commented 7 years ago

Hi @Simobain , try it in angular way. like, in template

ng-style="{'background-image': 'url(' + vm.cdnPath +'/' + destination.urlPictureCity+ ')'}"

in js

vm.cdnPath = someEnvVar === 'production' ? 'http://your/cdn/path' : '';
Simobain commented 7 years ago

Thanks ! It should work. I made it by changing the css tag background-url by an img src.