Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/81.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html VS代码-如何自动转换内联样式字符串以响应内联样式对象_Html_Css_Visual Studio Code_Vscode Settings - Fatal编程技术网

Html VS代码-如何自动转换内联样式字符串以响应内联样式对象

Html VS代码-如何自动转换内联样式字符串以响应内联样式对象,html,css,visual-studio-code,vscode-settings,Html,Css,Visual Studio Code,Vscode Settings,基本上,我想将任何网页的HTML粘贴到VS代码中,按下一个按钮,viola就会转换如下内容 <div id="txt_2" style="position:absolute;left:1px;top:0px;width:958px;height:56px;overflow:hidden;"></div> 进入这个 <div id="txt_2" style={{ p

基本上,我想将任何网页的HTML粘贴到VS代码中,按下一个按钮,viola就会转换如下内容

<div id="txt_2" style="position:absolute;left:1px;top:0px;width:958px;height:56px;overflow:hidden;"></div>

进入这个

<div 
    id="txt_2" 
    style={{
        position: "absolute", 
        left: "1px", 
        top: "0px", 
        width: "958px", 
        height: "56px", 
        overflow: "hidden"
    }}></div>

…只需按一下按钮,就像此网站可以做到的那样:

虽然那个网站很棒,但我仍然必须复制/粘贴,来回复制/粘贴。如果一个页面有数百个样式字符串,您可以看到它们是如何消耗时间的


我查看了一下,但在Stack上没有看到专门针对这个问题的帖子。

我来自Casbin团队。的源代码是repo的主分支:并部署到gh pages分支

我们从中派生并添加了一些更改。通过使用我们的源代码,您可以组装一个脚本来自动针对多个文件运行

try this
This simple little tool (forked to htbkoo/CssToAndFromReact from staxmanade/CssToReact) is intended to help translate plain CSS into and back from the React in-line style specific JSON representation. Making it easy to copy and paste into an inline React component or a CSS stylesheet.

访问

您可以使用代码段转换选定的text@rioV8非常感谢。我知道这一点。然而,这更像是复制任何网站的body标签,将其放入VS代码中(因此它包含大量HTML),然后运行1个命令来格式化所有内容-包括将“class=”更改为“className=”,等等。智能地完全响应组件从任何网页的body标签返回的内容。