browser-sync & http server
browser-sync & http server
browser-sync
usage
# step 1
$ npm install -g browser-sync
# OR
$ npm i -g browser-sync
# step 2
$ cd build
# step 3
$ browser-sync start --server --files "./*.html"
$ browser-sync start --server --files "./*.*"
$ browser-sync start --server --files "./*.js"
$ browser-sync start --server --files "./*.css"

react
$ browser-sync start --server --files "public/*.*"
$ browser-sync start --server --files "./src/**/*.*"
$ browser-sync start --server --files "./public/**/*.*"
# http://localhost:3000/public/index.html
# 必须使用正确的路径
# 1. 在 project 根目录下,运行命令, 默认的 url 根路由,就是当前的路径
# browser-sync start --server --files "./dist/**/*.*"
# 访问 http://localhost:3000/dist/index.html
# 2. 直接在 dist 目录下,运行命令, 默认的 url 根路由,就是当前的路径
# browser-sync start --server --files "./**/*.*"
# 访问 http://localhost:3000/index.html
sass & gulp & browser-sync
$ sass --watch src:dist
# root path
$ browser-sync start --server --files "./**/*.*"
$ browser-sync start --server --files "./src/**/*.*"

browser-sync
https://github.com/xgqfrms-GitHub/browser-sync
$ npm install -g browser-sync
$ npm i -S browser-sync
run
$ browser-sync start --server --files "./*.*"
PS G:\wwwRoot\AngularJS\Angular-1.5.8-App\000-imooc-form-validation> browser-sync start
[BS] Copy the following snippet into your website, just before the closing </body> tag
<script id="__bs_script__">//<![CDATA[
document.write("<script async src='http://HOST:3001/node_modules/browser-sync/browser-sync-client.js?v=2.18.1'><\/script>".replace("HOST", location.hostname));
//]]></script>
[BS] Access URLs:
-------------------------------------
UI: http://localhost:3002
-------------------------------------
UI External: http://192.168.56.1:3002
-------------------------------------
$ browser-sync --help
$ browser-sync start --help
$ browser-sync start
$ browser-sync init --help
$ browser-sync reload --help
# 食谱
$ browser-sync recipe --help
PS G:\wwwRoot\AngularJS\Angular-1.5.8-App\000-imooc-form-validation> browser-sync --help
Commands:
start Start the server
init Create a configuration file
reload Send a reload event over HTTP protocol
recipe Generate the files for a recipe
Options:
--version Show version number [boolean]
For help running a certain command, type <command> --help
eg:
C:\Users\xray\AppData\Roaming\npm\node_modules\browser-sync\bin\browser-sync.js
start --help
PS G:\wwwRoot\AngularJS\Angular-1.5.8-App\000-imooc-form-validation> browser-sync start --help
Usage:
C:\Users\xray\AppData\Roaming\npm\node_modules\browser-sync\bin\browser-sync.js
start [options]
Options:
--version Show version number [boolean]
--server, -s Run a Local server (uses your cwd as the web root)
--serveStatic, --ss Directories to serve static files from [array]
--port Specify a port to use [number]
--proxy, -p Proxy an existing server
--ws Proxy mode only - enable websocket proxying [boolean]
--browser, -b Choose which browser should be auto-opened [array]
--files, -f File paths to watch [array]
--index Specify which file should be used as the index page
[string]
--plugins Load Browsersync plugins [array]
--extensions Specify file extension fallbacks [array]
--startPath Specify the start path for the opened browser [string]
--https Enable SSL for local development
--directory Show a directory listing for the server [boolean]
--xip Use xip.io domain routing [boolean]
--tunnel Use a public URL
--open Choose which URL is auto-opened (local, external or
tunnel), or provide a url [string]
--cors Add Access Control headers to every request [boolean]
--config, -c Specify a path to a configuration file [string]
--host Specify a hostname to use
--logLevel Set the logger output level (silent, info or debug)
--reload-delay Time in milliseconds to delay the reload event
following file changes [number]
--reload-debounce Restrict the frequency in which browser:reload events
can be emitted to connected clients [number]
--ui-port Specify a port for the UI to use [number]
--no-notify Disable the notify element in browsers
--no-open Don't open a new browser window
--no-online Force offline usage
--no-ui Don't start the user interface
--no-ghost-mode Disable Ghost Mode
--no-inject-changes Reload on every file change
--no-reload-on-restart Don't auto-reload all browsers following a restart
--help Show help [boolean]
Examples:
C:\Users\xray\AppData\Roaming\npm\node_m - Use the App directory to serve
odules\browser-sync\bin\browser-sync.js files
start -s app
C:\Users\xray\AppData\Roaming\npm\node_m - Proxy an existing website
odules\browser-sync\bin\browser-sync.js
start -p www.bbc.co.uk
PS G:\wwwRoot\AngularJS\Angular-1.5.8-App\000-imooc-form-validation>
PS G:\wwwRoot\AngularJS\Angular-1.5.8-App\000-imooc-form-validation> browser-sync init --help
Usage:
C:\Users\xray\AppData\Roaming\npm\node_modules\browser-sync\bin\browser-sync.js
init
Options:
--version Show version number [boolean]
--help Show help [boolean]
Examples:
C:\Users\xray\AppData\Roaming\npm\node_m
odules\browser-sync\bin\browser-sync.js
init
PS G:\wwwRoot\AngularJS\Angular-1.5.8-App\000-imooc-form-validation> browser-sync reload --help
Usage:
C:\Users\xray\AppData\Roaming\npm\node_modules\browser-sync\bin\browser-sync.js
reload
Options:
--version Show version number [boolean]
--files, -f File paths to reload [array]
--port, -p Target a running instance by port number [number]
--url, -u Provide the full the url to the running Browsersync instance
--help Show help [boolean]
Examples:
C:\Users\xray\AppData\Roaming\npm\node_m
odules\browser-sync\bin\browser-sync.js
reload
C:\Users\xray\AppData\Roaming\npm\node_m
odules\browser-sync\bin\browser-sync.js
reload --port 4000
PS G:\wwwRoot\AngularJS\Angular-1.5.8-App\000-imooc-form-validation>
PS G:\wwwRoot\AngularJS\Angular-1.5.8-App\000-imooc-form-validation> browser-sync recipe --help
Usage:
C:\Users\xray\AppData\Roaming\npm\node_modules\browser-sync\bin\browser-sync.js
recipe <recipe-name>
Options:
--version Show version number [boolean]
--output, -o Specify an output directory
--help Show help [boolean]
Examples:
C:\Users\xray\AppData\Roaming\npm\node_m list the recipes
odules\browser-sync\bin\browser-sync.js
recipe ls
C:\Users\xray\AppData\Roaming\npm\node_m use the gulp.sass recipe
odules\browser-sync\bin\browser-sync.js
recipe gulp.sass
PS G:\wwwRoot\AngularJS\Angular-1.5.8-App\000-imooc-form-validation>
browser-sync & http server的更多相关文章
- web页面实时刷新之browser sync
web开发对实时刷新的需求 在刚开始学习前端时每次修改文件内容后都需要手工刷新下浏览器来看效果,做的次数多了就特别难受,有时仅仅修改了一个字母都需要刷新下页面查看 之后接触到编写边看的集成IDE,文件 ...
- Asp.Net连接Mysql报错Out of sync with server
Asp.Net连接Mysql报错Out of sync with server 原因:程序引用的MySql.Data.dll版本高于服务器版本 解决:下载一个低版本的MySql.Data.dll,项目 ...
- asp.net连接MySQL数据库错误-Out of sync with server
问题 网上说:http://wenda.haosou.com/q/1386389928069965 昨晚这个问题真的费了我不少时间(晚上9到凌晨2点),网上找解决方案,然后一个个尝试,没有成功.准备放 ...
- Sql Server 2008卸载后再次安装一直报错
sql server 2008卸载之后再次安装一直报错问题. 第一:由于上一次的卸载不干净,可参照百度完全卸载sql server2008 的方式 1. 用WindowsInstaller删除所有与S ...
- Setting up Django and your web server with uWSGI and nginx
https://uwsgi.readthedocs.io/en/latest/tutorials/Django_and_nginx.html Setting up Django and your we ...
- [r]Setting up Django and your web server with uWSGI and nginx
Setting up Django and your web server with uWSGI and nginx This tutorial is aimed at the Django user ...
- ie11 selenium 报错org.openqa.selenium.NoSuchWindowException: Unable to get browser 处理方法
selenium + ie11运行报错 org.openqa.selenium.NoSuchWindowException: Unable to get browser (WARNING: The s ...
- Debian上安装TightVNC Server
from:www.penlug.org/twiki/bin/view/Main/TightVNC Using VNC The tool vncserver allows you to run ad ...
- SQL Server 连接问题-TCP/IP
原文:SQL Server 连接问题-TCP/IP 出自:http://blogs.msdn.com/b/apgcdsd/archive/2012/02/24/ms-sql-server-tcp-ip ...
- Server.Transfer VS Response.Redirect – Simplified
https://www.codeproject.com/Articles/775221/Server-Transfer-VS-Response-Redirect-Simplified Introduc ...
随机推荐
- [转]OPENCV3.3+CUDA9.0 环境搭建若干错误总结
编译OpenCV设计启用OpenGL三维可视化支持和启用GPU CUDA并行加速处理的基本知识: 1.从2.4.2版本开始,OpenCV在可视化窗口中支持OpenGL,这就意味着在OpenCV中可以轻 ...
- Leetcode——300. 最长上升子序列
题目描述:题目链接 给定一个无序的整数数组,找到其中最长上升子序列的长度. 示例: 输入: [10,9,2,5,3,7,101,18] 输出: 4 解释: 最长的上升子序列是 [2,3,7,101], ...
- Java UDP和TCP的区别
为什么要写这篇博客:是这样的,最近听朋友说,有不少公司面试的时候会问道TCP和UDp的却别,所以就写出一篇简单的来描述他们之间的区别,送给那些即将面试的朋友们. UDP: 1.UDP, a.将数据以及 ...
- Android 连续按两次back键退出系统
需求:在程序的首页,连续按两次back键退出Androd程序. 第一步:新建一个GApplication类继承Application,在GApplication中添加一个用于存放Activity的集合 ...
- Oracle substr() instr() 用法
转载:oracle中substr() instr() 用法 substr(字符串,截取开始位置,截取长度) = 返回截取的字符串instr(源字符串,目标字符串,起始字符串,匹配字符串) = 返回要截 ...
- EZ 2017 12 17初二初三第一次膜你赛
以后平时练习还是写一写吧. (题目搞来搞去太烦了,直接PDF存起来) T1 水题(???),主要是数据水,正解是设一个阙值,然而根本没人打.(暴力出奇迹) CODE #include<cstdi ...
- mfc CCombox系统定义成员函数
通过ID操作对象 CComboBox(组合框)控件 CComboBox类常用成员 CComboBox插入数据 CComboBox删除数据 CComboBox运用示例 一.CComboBox控件常用属性 ...
- LORA---关于LORA的30个常见问题解答
1) 什么是LoRa调制? LoRa (Long Range,远距离)是一种调制技术,与同类技术相比,提供更长的通信距离.调制是基于扩频技术,线性调制扩频(CSS)的一个变种,具有前向纠错(FEC). ...
- PowerBI开发 第六章:数据网管
Power BI的本地数据网管(On-Premises Data Gateway)是运行在组织内部的软件,用于管控外部用户访问内部(on-premises)数据的权限.PowerBI的网管像是一个尽职 ...
- 【Android UI设计与开发】第04期:引导界面(四)仿人人网V5.9.2最新版引导界面
这一篇我将会以人人网的引导界面为实例来展开详细的讲解,人人网的引导界面比较的新颖,不同于其他应用程序千篇一律的靠滑动来引导用户,而是以一个一个比较生动形象的动画效果展示在用户们的面前,有一种给人眼前一 ...