You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
removeFile plugin API for allowing plugins to participate in removeCombined #344
I personally don't see why each plugin would need to implement the removal logic separately. I think it would be simpler if new property functions were included on write, maybe:
Then when r.js is wrapping up it's optimizations it can unlink all the filesPaths it received following the same logic it uses for removing combined scripts. From the plugin author's perspective it wouldn't require too many changes. In the context of the text plugin it could look something like this:
It might even make sense to just add filePath as an optional argument to write and it's siblings...
Based on feedback I'd be happy to work this into a pull request. Disclaimer, I am not _at all_ familiar with the magic which occurs inside r.js, but I do ❤️ it.
The problem is that plugin dependency IDs are opaque to the loader -- it does not try to interpret what they mean. For a given dependency ID like 'pluginId!something-here', the 'something-here' part could be anything, a pointer to a more than one file, in the case of a 'has!some-test?ok.html:notok.html' case, or not even a file, like something that waits for an onload event from an img tag.
This API would only be used for plugins that do resolve to file(s) and would just be a simple way for them to declare that "I included this file so it can be deleted if that's what the user wants".
Activity
Remove removeCombined hack
spalger commentedon Sep 20, 2013
I personally don't see why each plugin would need to implement the removal logic separately. I think it would be simpler if new property functions were included on write, maybe:
write.fileContents(filePath|filePath[], contents)write.fileContentsAsModule(filePath|filePath[], moduleName, contents)Then when r.js is wrapping up it's optimizations it can unlink all the filesPaths it received following the same logic it uses for removing combined scripts. From the plugin author's perspective it wouldn't require too many changes. In the context of the text plugin it could look something like this:
It might even make sense to just add filePath as an optional argument to write and it's siblings...
Based on feedback I'd be happy to work this into a pull request. Disclaimer, I am not _at all_ familiar with the magic which occurs inside r.js, but I do ❤️ it.
jrburke commentedon Sep 23, 2013
The problem is that plugin dependency IDs are opaque to the loader -- it does not try to interpret what they mean. For a given dependency ID like 'pluginId!something-here', the 'something-here' part could be anything, a pointer to a more than one file, in the case of a 'has!some-test?ok.html:notok.html' case, or not even a file, like something that waits for an onload event from an img tag.
spalger commentedon Sep 25, 2013
This API would only be used for plugins that do resolve to file(s) and would just be a simple way for them to declare that "I included this file so it can be deleted if that's what the user wants".