VS Code 运行html文件

用VS Code编写html文件,想在VS Code中直接打开运行,配置如下:

配置tasks.json

  1. 打开VS Code,点击“终端”,选择“配置任务”。
  2. 选择“使用模板创建tasks.json文件”。
  3. 选择“Others”。
  4. tasks.json新建完成,默认如下图:
  5. 修改tasks.json
{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "在Chrome中运行",
            "type": "process",  // [shell,process]
            "command": "Chrome",
            "args": ["${file}"],
            "windows": {
                "command": "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe"
            },
            "group": "build",
            "presentation": {
                // Reveal the output only if unrecognized errors occur.
                "reveal": "never"  //[always,never,silent]
            },
            // Use the standard MS compiler pattern to detect errors, warnings and infos
            "problemMatcher": "$msCompile"
        }
    ]
}

运行任务

选中需要运行的html文件,按住Ctrl+Shift+B,选择“在Chome中运行”,即可。

文章出处:https://allanhao.com/2018/09/25/vscode-run-html/

原文地址:https://www.cnblogs.com/hao-zhang/p/9700363.html

时间: 2024-08-08 06:39:34

VS Code 运行html文件的相关文章

VS Code 运行 JavaScript 文件时出现“node...”乱码或错误

1.乱码图片: 2.如果是中文乱码的话,可以到设置里边把「Auto Guess Encoding」这一项勾起来. 3.如果不是这个原因,可能是因为没安装 Node.js 和配置 Node.js 环境,我就是这样子解决乱码问题的.在 windows 下安装和配置 Node.js 环境的教程可见:Node.js安装及环境配置(完整) 希望你的问题能够得到解决. 原文地址:https://www.cnblogs.com/lonelyWMW/p/11680043.html

图文介绍MyEclipse (2015) 中创建简单的Maven项目的步骤(用于生成可运行jar文件)

利用MyEclipse的引导,能够非常方便的创建简单的.用于生成可运行jar文件的Maven项目: (原创文章,转载请注明转自Clement-Xu的博客:http://blog.csdn.net/clementad/article/details/46954277) 1.New -> Project... 选择 Maven Project, 点击Next > 2.在Select projrect name and location界面,各选项例如以下图,点击Next > 3.在Selec

mysql运行sql文件出错

从服务器上备份表数据到本地,使用的工具是Navicat,右键表转储sql文件,但是在本地运行sql文件时一直报异常 [Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near **** [Err] /* 但是将文件中的sql语句直接在查询中运行时可以的 在网上查了几

InstallShield 2015 LimitedEdition VS2012 运行bat文件

转载:http://www.cnblogs.com/fengwenit/p/4271150.html  运行bat文件 网上很多介绍如何运行bat的方法,但我这个是limted 版本,不适用. 1. 打开 Define Setup Requirements and Actions –> Custom Actions 2. 右健 After Register Product –> New Exe 这是我自己的工程测试 install.bat 内容 rd/s/q %APPDATA%\test  

使用import和exec运行模块文件的异同

使用import和exec运行模块文件的异同 实例代码 #script1.py import sys print(sys.platform) x = 'span' print(x*8) 在cmd中 >>> import script1 win32 spanspanspanspanspanspanspanspan >>> exec(open('script1.py').read()) win32 spanspanspanspanspanspanspanspan 看上去毫无

用JSmooth制作java jar文件的可运行exe文件教程【图文】

这是我之前在个人博客3yj上面写的一篇文章,如今转载过来,原文地址 (这不是广告哦) 几年前,刚接触java的是,就想用一些方法把自己的劳动果实保护起来,曾经也用过非常多这种工具,有一个特别好用,今天写篇文章跟大家分享. 今天要用到的工具有 JSmooth 0.9.9-7 汉化版,能够到本站下载:JSmooth 0.9.9-7 汉化版 首先要把你的程序打包成双击能够运行的包,详细的方法我就不多说了,网上非常多的,主要命令是:jar cvfm test.jar *.* -C  之类的 主要是确保其

c# winform 获取当前程序运行根目录,winform 打开程序运行的文件夹

// 获取程序的基目录. System.AppDomain.CurrentDomain.BaseDirectory // 获取模块的完整路径. System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName // 获取和设置当前目录(该进程从中启动的目录)的完全限定目录. System.Environment.CurrentDirectory // 获取应用程序的当前工作目录. System.IO.Directory.GetC

Linux下sh文件运行及桌面环境双击运行sh文件

sh文件运行: 1.修改为可执行权限: chmod u+x hello.sh 2.运行 ./hello.sh 3.不使用可执行权限修改,用sh直接运行 sh ./hello.sh 桌面环境双击运行sh文件: Mac: 1.修改后缀sh变成command:hello.sh->hello.command 2.修改可执行权限:chmod u+x hello.command Ubuntu: 1.修改可执行权限:chmod u+x hello.sh 2.任意打开一个文件夹,选择左上角的[编辑]->[首选

用bat运行.jar文件

1)首先,将Java文件打包为"可运行的.jar",以Hello.java为例,如下: 代码为: package cn; public class Hello { public static void main(String[] args) { System.out.println("Hello world!"); } } 操作如下: 2)编写一个批处理文件:testHello.bat,内容如下: java -version java -jar Hello.jar