zl程序教程

您现在的位置是:首页 >  前端

当前栏目

npm serve md 工具 [MD]

npm工具 md Serve
2023-09-14 09:00:05 时间

博文地址

我的GitHub 我的博客 我的微信 我的邮箱
baiqiantao baiqiantao bqt20094 baiqiantao@sina.com

目录

常用的几个 npm 工具

npm serve

Static file serving and directory listing.

serve a static site, a single page application, a static file, no matter if on your device or on the local network

基本使用

最简单的使用方式:在当前目录下执行命令npx serve即可。

yarn global add serve  # 全局安装 serve
serve -v               # 查看版本
serve --help           # 查看帮助文件

serve                  # 在当前目录下启动服务,启动后会自动将地址拷贝到粘贴板
serve -p 10086         # 在当前目录下启动服务,并指定端口【http://localhost:10086】
serve folder_name      # 在指定的目录下启动服务

By default, serve will listen on 0.0.0.0:3000 and serve the current working directory on that address.

支持的参数

常用

  • -l, listen:Specify a URI endpoint 端点 on which to listen, more than one may be specified to listen in multiple places
  • -p, port:Specify custom port 端口
  • -d, debug:Show debugging information
  • -s, single:Rewrite all not-found requests to index.html

不常用

  • -c, config:Specify custom path to serve.json
  • -C, cors:Enable CORS, sets Access-Control-Allow-Origin to *
  • -n, no-clipboard:Do not copy the local address to the clipboard
  • -u, no-compression:Do not compress files
  • -S, symlinks:Resolve symlinks instead of showing 404 errors
  • --no-etag:Send Last-Modified header instead of ETag
  • --ssl-cert:Optional path to an SSL/TLS certificate to serve with HTTPS
  • --ssl-key:Optional path to the SSL/TLS certificate's private key 私钥
  • --ssl-pass:Optional path to the SSL/TLS certificate's passphrase 密钥
  • --no-port-switching:Do not open a port other than 除了 the one specified when it's taken.

监听端口

Listen endpoints (specified by the --listen or -l options above) instruct 指示 serve to listen on one or more interfaces/ports, UNIX domain sockets, or Windows named pipes.

  • For TCP ports on hostname "localhost":serve -l 1234
  • For TCP (traditional host/port) endpoints:serve -l tcp://hostname:1234
  • For UNIX domain socket endpoints:serve -l unix:/path/to/socket.sock
  • For Windows named pipe endpoints:serve -l pipe:\\.\pipe\PipeName

npm md

一款高度简洁的微信 Markdown 编辑器:支持 Markdown 所有基础语法、色盘取色、一键复制并粘贴到公众号后台、多图上传、一键下载文档、自定义 CSS 样式、一键重置等特性

开发和部署

npm i               # 安装依赖
npm run serve       # 启动开发模式
npm run build       # 输出部署版本

2017-01-16