angularjspdfcachinggruntjsgrunt-usemin

file revving with generated name call


I have a problem using grunt with filerev, usemin and angular

For the concept, let's say we have: bar.english.PDF and bar.french.PDF

the filerev work fine and I have bar.english.XXXXXXX.pdf & bar.french.XXXXX.pdf

The problem i am facing is in the way i call those templates. The way i am implementing is as follows:

angular.module('x').directive('x', function(COUNTRY) {
  return {
    restrict: 'E',
    replace: true,
    template: '<a href="/pdf/bar.' + COUNTRY +'.pdf" >bla bla bla</a>',
    link: function(scope, element, attrs) {
        //some basic stuff
    }
  };
});

My problem in this situation is "usemin/filerev" do not work because the filename is generated when i call it in the code. I have tried many different regexp in usemin/filerev, picking everything of the href attribute or only piece of it. However it didn't work either way.

I'm "sure" the filerev/usemin is fine .It's working with my ng-replace tags in others piece of code (ps: they are not dynamic name generated).

I have look on SO/google for a while now and i still can't figure out a solution to handle this.

I suppose it's a general problem but if you need my gruntfile usemin/filerev section, please ask in comment.

Can someone lead me the way with a useful doc (yeoman/gruntjs did not put this scenario in their docs) like working simple code or advance tutorial somewhere please?. At this point, any useful resource is good to have.


Solution

  • Assuming COUNTRY is a constant in angular, how would you expect filerev/usemin to replace that constant with the new file name? And why not just leave the file name as is? Just exclude bar.english.PDF and bar.french.PDF from these tasks I would say.

    Repost as my comment seems to be the accepted answer