V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
2214962083

和大佬合作开发了一个点击 dom 自动打开编辑器跳转到指定源码的打包器插件

  •  2
     
  •   2214962083 · Oct 27, 2022 · 1942 views
    This topic created in 1281 days ago, the information mentioned may be changed or developed.

    接手一个项目开发网页时要修改某部分,要么靠搜索,要么靠记忆找到对应代码,过程极为浪费时间。

    在项目里用了 dom-to-code 插件后,对准想要修改的 dom 部分 ctrl + 按下鼠标滚轮,就会在编辑器打开对应的 dom 元素源码。这极大地提升了维护屎山代码地速度。感兴趣的可以试试,真的能提高开发网页效率。

    支持 vite/webpack + vue2/vue3/react

    支持 vscode/webstorm

    Github: https://github.com/better-tcy/dom-to-code

    示例

    3 replies    2022-10-27 12:18:32 +08:00
    Melting
        1
    Melting  
       Oct 27, 2022
    很棒的功能,要是能做成 chrome 扩展就更好了,可以避免添加代码
    JsTyx
        2
    JsTyx  
       Oct 27, 2022 via iPhone
    好!
    2214962083
        3
    2214962083  
    OP
       Oct 27, 2022 via iPhone
    @Melting 这个难以实现,因为要在编译时记录文件路径和代码行号到 dom attribute ,所以改动打包器配置是必须的
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2719 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 14:05 · PVG 22:05 · LAX 07:05 · JFK 10:05
    ♥ Do have faith in what you're doing.