grunt-filerev-assets icon indicating copy to clipboard operation
grunt-filerev-assets copied to clipboard

provide a way to manipulate the paths

Open airtonix opened this issue 11 years ago • 2 comments

I'm using this to map templates for use in client side angular projects. Unfortunately on windows local development, grunt-filerev will create paths with the incorrect slash \\ instead of /.

While it's great that you account for a change in the root of the path, perhaps we could use a callback or a regular expression to modify it instead?

something like :

    filerev_assets:
      dist:
        options:
          dest: "templates/map.json"
          cwd: "<%= paths.dist %>"
          prefix: ""
          prettyPrint: true
          patterns: [
              s/\\\\/\//
              s/dist\///
          ]

and/or

    filerev_assets:
      dist:
        options:
          dest: "templates/map.json"
          cwd: "<%= paths.dist %>"
          prefix: ""
          prettyPrint: true
          patterns: (value, key) ->
              if !value.indexOf "html" or !key.indexOf "html"
                  return
              value = value.replace '\\', '/'
              value = value.replace 'dist/', ''

excuse me if my regex sucks.

airtonix avatar Feb 09 '14 06:02 airtonix

Sure - feel free to submit a pull request with tests and I'd be happy to merge this idea.

richardbolt avatar Apr 22 '14 02:04 richardbolt

This PR solves the problem #8

robhrt7 avatar Jul 04 '14 12:07 robhrt7