jonkemp / useref

Parse build blocks in HTML files to replace references
MIT License
51 stars 13 forks source link

Add handler to parse source and transform target paths #20

Closed xsawo closed 6 years ago

xsawo commented 6 years ago

This PR introduces two new options (handler functions) to parse source and transform target paths. We use a template engine where the paths to the resources are generate at runtime and therefore it's necessary to modify the paths before processing. I've added a test to show a possible use-case.

options.parseSourcePath

Type: Function Return: The path to the source file

Function to parse the source path out of a script or style element.

The function gets the following arguments:

options.transformTargetPath

Type: Function Return: The transformed path to the target file

Function to transform the target file path.

The function gets the following arguments:

xsawo commented 6 years ago

This also fix issue #10