BrowserSync,自動刷新,解放F5,去掉更新提示
阿新 • • 發佈:2017-12-23
介紹 blog nod display server 成功 一個 file str
BrowserSync雖然這個技術不算新,但是依然有用。略微介紹下
沒有安裝node,先安裝node,這裏不再做介紹
安裝
npm install -g browser-sync 全局安裝,方便在任意目錄下啟動
所在項目中啟動
browser-sync start --server --files "**" 所有文件都檢測改變刷新,並自動打開瀏覽器
http://localhost:3000/ 相當於你的index.html文件,如果你的html文件夾下有個db.html,那麽地址就是 http://localhost:3000/html/db.html
去掉更新成功的 Connected to BrowserSync 提示
其實這是browser-sync-client.js 動態生成的一個div,id名叫 __bs_notify__ ,那我們直接在在一個公共的css文件下加上以下樣式代碼即可去掉提示
#__bs_notify__{
display: none!important;
}
BrowserSync,自動刷新,解放F5,去掉更新提示