简体   繁体   English

可以编辑第三方JavaScript插件吗?

[英]Is it ok to edit 3rd party javascript plugins?

We need to edit the source code (a single javascript file) of a 3rd party plugin to make its UI rendered with bootstrap classes. 我们需要编辑3rd party插件的源代码(单个javascript文件),以使其UI带有引导类。 This plugin does not download as a node module (npm). 该插件不会下载为节点模块(npm)。 So is it okay to do that ? 那可以这样做吗? Because i have heard some people say - never edit source code of 3rd party plugins. 因为我听过有人说-永远不要编辑第三方插件的源代码。 Thanks. 谢谢。

First of all - check the license of the plugin. 首先-检查插件的许可证。

Second - the reason why it is not recommended to change a plugin is that if you are upgrading the script - your edit will be lost, and it hard to track such problems. 其次-不建议更改插件的原因是,如果您要升级脚本-您的编辑将丢失,并且很难跟踪此类问题。 It is better to make the code maintainers change their code, with offering them the change, create new git branch in their repository etc. 最好让代码维护者更改其代码,向他们提供更改,在其存储库中创建新的git分支,等等。

You can do it, but you risk breaking other parts in the library itself that you may not be aware of. 可以执行此操作,但是可能会破坏库本身可能不知道的其他部分。 It's possible that your changes could have side effects and puts you at a disadvantage when it comes time to upgrade the library. 您所做的更改可能会产生副作用,并在升级库时使您处于不利地位。 But in the end you should follow the license to see what you're allowed to do. 但是最后,您应该遵循许可证来查看您被允许执行的操作。

If it's a change that could be beneficial to others, then contribute to the project with your changes. 如果这是一项对他人有益的变更,那么请通过您的变更为项目做出贡献。

You could also try overriding the specific part you need in a separate file. 您也可以尝试在单独的文件中覆盖所需的特定部分。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM