browser-sync & http server

browser-sync

https://www.browsersync.io/

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

browsersync-react.md

https://browsersync.io/

$ 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的更多相关文章

  1. web页面实时刷新之browser sync

    web开发对实时刷新的需求 在刚开始学习前端时每次修改文件内容后都需要手工刷新下浏览器来看效果,做的次数多了就特别难受,有时仅仅修改了一个字母都需要刷新下页面查看 之后接触到编写边看的集成IDE,文件 ...

  2. Asp.Net连接Mysql报错Out of sync with server

    Asp.Net连接Mysql报错Out of sync with server 原因:程序引用的MySql.Data.dll版本高于服务器版本 解决:下载一个低版本的MySql.Data.dll,项目 ...

  3. asp.net连接MySQL数据库错误-Out of sync with server

    问题 网上说:http://wenda.haosou.com/q/1386389928069965 昨晚这个问题真的费了我不少时间(晚上9到凌晨2点),网上找解决方案,然后一个个尝试,没有成功.准备放 ...

  4. Sql Server 2008卸载后再次安装一直报错

    sql server 2008卸载之后再次安装一直报错问题. 第一:由于上一次的卸载不干净,可参照百度完全卸载sql server2008 的方式 1. 用WindowsInstaller删除所有与S ...

  5. 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 ...

  6. [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 ...

  7. ie11 selenium 报错org.openqa.selenium.NoSuchWindowException: Unable to get browser 处理方法

    selenium + ie11运行报错 org.openqa.selenium.NoSuchWindowException: Unable to get browser (WARNING: The s ...

  8. Debian上安装TightVNC Server

    from:www.penlug.org/twiki/bin/view/Main/TightVNC Using VNC   The tool vncserver allows you to run ad ...

  9. SQL Server 连接问题-TCP/IP

    原文:SQL Server 连接问题-TCP/IP 出自:http://blogs.msdn.com/b/apgcdsd/archive/2012/02/24/ms-sql-server-tcp-ip ...

  10. Server.Transfer VS Response.Redirect – Simplified

    https://www.codeproject.com/Articles/775221/Server-Transfer-VS-Response-Redirect-Simplified Introduc ...

随机推荐

  1. Blog Contents

    This page is intently left for contents catalog of my articles. |----------------------------------- ...

  2. 【chrome】"您的连接不是私密连接" 解决办法

    1.启用显示证书选项 在Chrome的地址栏中输入:chrome://flags/#show-cert-link,选择"启用",重启Chrome浏览器.  (操作过无用) 2.安装 ...

  3. Android Studio 设置代码提示和代码自动补全快捷键--Eclipse 风格 - 转

    首先本文转自http://blog.csdn.net/csdnzouqi/article/details/50454703,是为了方便以后查看这些设置,最后在这里感谢原博主. 为了能跟上技术发展的脚步 ...

  4. 大数据入门第二十二天——spark(二)RDD算子(2)与spark其它特性

    一.JdbcRDD与关系型数据库交互 虽然略显鸡肋,但这里还是记录一下(点开JdbcRDD可以看到限制比较死,基本是鸡肋.但好在我们可以通过自定义的JdbcRDD来帮助我们完成与关系型数据库的交互.这 ...

  5. 20155232《网络对抗》Exp 6 信息搜集与漏洞扫描

    20155232<网络对抗>Exp 6 信息搜集与漏洞扫描 一.实践内容 (1)各种搜索技巧的应用 (2)DNS IP注册信息的查询 (3)基本的扫描技术:主机发现.端口扫描.OS及服务版 ...

  6. 20155308《网络对抗》Exp8 Web基础

    20155308<网络对抗>Exp8 Web基础 实践原理与实践说明 本实践的具体要求有: (1).Web前端HTML 能正常安装.启停Apache.理解HTML,理解表单,理解GET与P ...

  7. 20155334 《网络攻防》 Exp6 信息搜集与漏洞扫描

    20155334 Exp6 信息搜集与漏洞扫描 一.实验问题回答 哪些组织负责DNS,IP的管理? 答:互联网名称与数字地址分配机构 ICANN ,该机构决定了域名和IP地址的分配.负责协调管理DNS ...

  8. Jmeter 安装后无法启动问题

    问题:按照教程java环境安装完成,也下载了 Jmeter  安装包,但是在启动的时候 dos窗口就一直提示下面的错误信息 ‘findstr' 不是内部或外部命令,也不是可运行的程序或批处理文件.  ...

  9. 【php增删改查实例】第九节 - 部门管理模块(模糊查询)

    给datagrid添加一个工具栏. 效果: 模糊查询部门名称. 接下来,在工具栏区域画一个input框: <div id="toolbar" style="padd ...

  10. 异常 java.lang.IllegalArgumentException: Result Maps collection already contains value

    这是因为用了一次以上(多次)mbg导致sql映射文件堆积导致的异常,删除对应的sql映射文件,然后重新生成即可. Caused by: java.lang.IllegalArgumentExcepti ...