如何修改Drupal贡献模块中的js
我想稍微修改一下捆绑在 drupal 贡献模块中的 javascript 文件,例如将特定的 #id 更改为 css .class 等。据我所知,出于升级原因修改该模块的源代码是不好的。那么,你能教我如何最好地做到这一点吗?
I want to modify a javascript file bundled in a drupal contributed module a little bit, for example changing a specific #id to css .class etc. As far as i know it's not good to modify source code of that module for upgrade reason. So, can you pls teach me how to do that the best way?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您可以在单独的 .css 文件中完成您想要的任务,那就最好了。
如果这是一个可以增强模块的改进,只需进行修改并将补丁提交回社区即可。 drupal 站点提供了有关如何创建补丁的完整详细信息。
如果补丁非常具体,请查看是否有办法使其通用,以便您可以提交它。
如果所有其他方法都失败了,并且您必须进行更改,请发表评论。最好创建一个包含更改的补丁文件并将其保存在 contrib 模块目录之外。不进行更改的全部原因是更新变得非常痛苦。如果您记录了所做的每项更改,并且确信可以重新应用它们,那么应该没问题。
If you can accomplish what you want in a separate .css file, that would be best.
If it's an improvement that would enhance the module, simply make the modification and submit the patch back to the community. The drupal site has full details on how to create a patch.
If the patch is very specific, see if there's a way to make it generic so that you can submit it.
If all else fails, and you have to make the change, COMMENT. It's also good to create a patch file with the change and save it outside of the contrib module directory. The whole reason to NOT make changes is that updates become a real pain. If you document every change you make, and feel confident that you can re-apply them, then you should be OK.