I guess it should work (note that I am not a coder)
But please advise or correct if it’s the proper way to do it or if it exists any other cleaner and simpler option (more Hugo oriented if any)
Based on my testing this morning, I suspect this works when you build your site with hugo, but fails to update upon changes to your site when running hugo server.
When using Hugo Pipes, the documentation states that:
Asset files must be stored in the asset directory. This is /assets by default, but can be configured via the configuration file’s assetDir key.
You, on the other hand, are attempting to use Hugo Pipes in conjunction with Page Resources. This combination is undocumented, and at least one other person has encountered the problem I described above: