项目作者: xgqfrms-GitHub

项目描述 :
browser-sync
高级语言: JavaScript
项目地址: git://github.com/xgqfrms-GitHub/browser-sync.git
创建时间: 2016-10-10T04:52:44Z
项目社区:https://github.com/xgqfrms-GitHub/browser-sync

开源协议:

下载


browser-sync

https://www.browsersync.io/

usage

  1. # step 1
  2. $ npm install -g browser-sync
  3. # OR
  4. $ npm i -g browser-sync
  5. # step 2
  6. $ cd build
  7. # step 3
  8. $ browser-sync start --server --files "./*.html"
  9. $ browser-sync start --server --files "./*.*"
  10. $ browser-sync start --server --files "./*.js"
  11. $ browser-sync start --server --files "./*.css"

browsersync & node.js & static html.png

react

browsersync-react.md

https://browsersync.io/

  1. $ browser-sync start --server --files "public/*.*"
  2. $ browser-sync start --server --files "./src/**/*.*"
  3. $ browser-sync start --server --files "./public/**/*.*"
  4. # http://localhost:3000/public/index.html
  5. # 必须使用正确的路径
  6. # 1. 在 project 根目录下,运行命令, 默认的 url 根路由,就是当前的路径
  7. # browser-sync start --server --files "./dist/**/*.*"
  8. # 访问 http://localhost:3000/dist/index.html
  9. # 2. 直接在 dist 目录下,运行命令, 默认的 url 根路由,就是当前的路径
  10. # browser-sync start --server --files "./**/*.*"
  11. # 访问 http://localhost:3000/index.html

sass & gulp & browser-sync

  1. $ sass --watch src:dist
  2. # root path
  3. $ browser-sync start --server --files "./**/*.*"
  4. $ browser-sync start --server --files "./src/**/*.*"


browser-sync

https://github.com/xgqfrms-GitHub/browser-sync

  1. $ npm install -g browser-sync
  2. $ npm i -S browser-sync

run

  1. $ browser-sync start --server --files "./*.*"
  1. PS G:\wwwRoot\AngularJS\Angular-1.5.8-App\000-imooc-form-validation> browser-sync start
  2. [BS] Copy the following snippet into your website, just before the closing </body> tag
  3. <script id="__bs_script__">//<![CDATA[
  4. 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));
  5. //]]></script>
  6. [BS] Access URLs:
  7. -------------------------------------
  8. UI: http://localhost:3002
  9. -------------------------------------
  10. UI External: http://192.168.56.1:3002
  11. -------------------------------------
  1. $ browser-sync --help
  2. $ browser-sync start --help
  3. $ browser-sync start
  4. $ browser-sync init --help
  5. $ browser-sync reload --help
  6. # 食谱
  7. $ browser-sync recipe --help
  1. PS G:\wwwRoot\AngularJS\Angular-1.5.8-App\000-imooc-form-validation> browser-sync --help
  2. Commands:
  3. start Start the server
  4. init Create a configuration file
  5. reload Send a reload event over HTTP protocol
  6. recipe Generate the files for a recipe
  7. Options:
  8. --version Show version number [boolean]
  9. For help running a certain command, type <command> --help
  10. eg:
  11. C:\Users\xray\AppData\Roaming\npm\node_modules\browser-sync\bin\browser-sync.js
  12. start --help
  13. PS G:\wwwRoot\AngularJS\Angular-1.5.8-App\000-imooc-form-validation> browser-sync start --help
  14. Usage:
  15. C:\Users\xray\AppData\Roaming\npm\node_modules\browser-sync\bin\browser-sync.js
  16. start [options]
  17. Options:
  18. --version Show version number [boolean]
  19. --server, -s Run a Local server (uses your cwd as the web root)
  20. --serveStatic, --ss Directories to serve static files from [array]
  21. --port Specify a port to use [number]
  22. --proxy, -p Proxy an existing server
  23. --ws Proxy mode only - enable websocket proxying [boolean]
  24. --browser, -b Choose which browser should be auto-opened [array]
  25. --files, -f File paths to watch [array]
  26. --index Specify which file should be used as the index page
  27. [string]
  28. --plugins Load Browsersync plugins [array]
  29. --extensions Specify file extension fallbacks [array]
  30. --startPath Specify the start path for the opened browser [string]
  31. --https Enable SSL for local development
  32. --directory Show a directory listing for the server [boolean]
  33. --xip Use xip.io domain routing [boolean]
  34. --tunnel Use a public URL
  35. --open Choose which URL is auto-opened (local, external or
  36. tunnel), or provide a url [string]
  37. --cors Add Access Control headers to every request [boolean]
  38. --config, -c Specify a path to a configuration file [string]
  39. --host Specify a hostname to use
  40. --logLevel Set the logger output level (silent, info or debug)
  41. --reload-delay Time in milliseconds to delay the reload event
  42. following file changes [number]
  43. --reload-debounce Restrict the frequency in which browser:reload events
  44. can be emitted to connected clients [number]
  45. --ui-port Specify a port for the UI to use [number]
  46. --no-notify Disable the notify element in browsers
  47. --no-open Don't open a new browser window
  48. --no-online Force offline usage
  49. --no-ui Don't start the user interface
  50. --no-ghost-mode Disable Ghost Mode
  51. --no-inject-changes Reload on every file change
  52. --no-reload-on-restart Don't auto-reload all browsers following a restart
  53. --help Show help [boolean]
  54. Examples:
  55. C:\Users\xray\AppData\Roaming\npm\node_m - Use the App directory to serve
  56. odules\browser-sync\bin\browser-sync.js files
  57. start -s app
  58. C:\Users\xray\AppData\Roaming\npm\node_m - Proxy an existing website
  59. odules\browser-sync\bin\browser-sync.js
  60. start -p www.bbc.co.uk
  61. PS G:\wwwRoot\AngularJS\Angular-1.5.8-App\000-imooc-form-validation>
  1. PS G:\wwwRoot\AngularJS\Angular-1.5.8-App\000-imooc-form-validation> browser-sync init --help
  2. Usage:
  3. C:\Users\xray\AppData\Roaming\npm\node_modules\browser-sync\bin\browser-sync.js
  4. init
  5. Options:
  6. --version Show version number [boolean]
  7. --help Show help [boolean]
  8. Examples:
  9. C:\Users\xray\AppData\Roaming\npm\node_m
  10. odules\browser-sync\bin\browser-sync.js
  11. init
  12. PS G:\wwwRoot\AngularJS\Angular-1.5.8-App\000-imooc-form-validation> browser-sync reload --help
  13. Usage:
  14. C:\Users\xray\AppData\Roaming\npm\node_modules\browser-sync\bin\browser-sync.js
  15. reload
  16. Options:
  17. --version Show version number [boolean]
  18. --files, -f File paths to reload [array]
  19. --port, -p Target a running instance by port number [number]
  20. --url, -u Provide the full the url to the running Browsersync instance
  21. --help Show help [boolean]
  22. Examples:
  23. C:\Users\xray\AppData\Roaming\npm\node_m
  24. odules\browser-sync\bin\browser-sync.js
  25. reload
  26. C:\Users\xray\AppData\Roaming\npm\node_m
  27. odules\browser-sync\bin\browser-sync.js
  28. reload --port 4000
  29. PS G:\wwwRoot\AngularJS\Angular-1.5.8-App\000-imooc-form-validation>
  1. PS G:\wwwRoot\AngularJS\Angular-1.5.8-App\000-imooc-form-validation> browser-sync recipe --help
  2. Usage:
  3. C:\Users\xray\AppData\Roaming\npm\node_modules\browser-sync\bin\browser-sync.js
  4. recipe <recipe-name>
  5. Options:
  6. --version Show version number [boolean]
  7. --output, -o Specify an output directory
  8. --help Show help [boolean]
  9. Examples:
  10. C:\Users\xray\AppData\Roaming\npm\node_m list the recipes
  11. odules\browser-sync\bin\browser-sync.js
  12. recipe ls
  13. C:\Users\xray\AppData\Roaming\npm\node_m use the gulp.sass recipe
  14. odules\browser-sync\bin\browser-sync.js
  15. recipe gulp.sass
  16. PS G:\wwwRoot\AngularJS\Angular-1.5.8-App\000-imooc-form-validation>