I'm using this library (via gulp-useref) on a .NET project, and as such I need to apply a transform to the final path that is output into the html for each block. In my specific case, I need to wrap the url in src attribute for css refs with a bit of server side .NET code. I've made the necessary updates to add this functionality (it was just 2 lines added to the refManager.js), and if it's useful to others, I can submit a pull request.
if present, this function will be passed the target output path, the build type (css, js, etc), the extra attributes in the build tag, and the search paths included in the build tag. The function should return a string, and that string is used as the target when constructing the final output html. Again using the example above, my options passed into useref (again, via gulp-useref) to achieve the desired result are:
I'm using this library (via gulp-useref) on a .NET project, and as such I need to apply a transform to the final path that is output into the html for each block. In my specific case, I need to wrap the url in src attribute for css refs with a bit of server side .NET code. I've made the necessary updates to add this functionality (it was just 2 lines added to the refManager.js), and if it's useful to others, I can submit a pull request.
For example, given the following input block:
I need to produce the following output (after concatinating and writing the final result css file):
To achieve this, I added a "transformOutputPath" option that takes a function with signature:
if present, this function will be passed the target output path, the build type (css, js, etc), the extra attributes in the build tag, and the search paths included in the build tag. The function should return a string, and that string is used as the target when constructing the final output html. Again using the example above, my options passed into useref (again, via gulp-useref) to achieve the desired result are:
As I mentioned above, if this feature is useful to others, I can submit a pull request.