search
HomeWeb Front-endHTML Tutorial三个生产力工具:Browsersync, WhatFont 和 Alfred_html/css_WEB-ITnose

Browsersync

做 Web 开发的时候,我们做一些修改然后刷新页面查看效果。 Browsersync 可以让你省去后面那一步,只要修改网页文件保存就可以,它会监控文件的变化(html/js/css)并自动刷新页面,这样就不用手动刷新了。Good!

图片来自网络

Browsersync 真正强大的地方在于跨设备同步。你可以用桌面、手机、平板等不同设备的浏览器同时打开你正在开发的网页,其中任何一个页面上的操作(如点击、滚动、表单填写和提交)会在所有其它页面上自动同步!当然,同一个机器上的同一个浏览器或不同浏览器的多个页面也可以。

图片来自网络

例如,你在两台电脑(Win和Mac)、Android 手机和 iPad 平板上同时打开指定的页面,你所做的任何文件修改在这4个浏览器上都会自动刷新,在任何一个打开的页面上滚动页面或点击链接跳转,所有其它页面上都会同时执行同一操作。这样大幅提高了你在多设备、多浏览器上的开发和测试效率!

安装和使用

1. 安装

Shell

npm install -g browser-sync
npminstall -g browser-sync

2. 启用

Shell

browser-sync start --server --files "css/*.css"
browser-syncstart --server --files "css/*.css"

上面的命令针对静态网页启动了一个简单的 web server ,并且会监控 css 文件的变化。如果是动态页面则需要使用代理模式:

Shell

browser-sync start --proxy "myproject.dev" --files "css/*.css"
browser-syncstart --proxy "myproject.dev" --files "css/*.css"

另外,Browsersync 可以和 Gulp 集成 或 Grunt 集成 。

启动后的默认服务地址是:http://localhost:3000 或 http://your-ip:3000 ,使用浏览器打开该地址下的页面即可。

http://localhost:3001 是 Browsersync 服务的配置页面,可以设置同步选项、网速模拟等。

除了 Browsersync ,另外一个类似的工具是 LiveReload 。

WhatFont

如果你想知道页面中某个位置使用的字体,试试 WhatFont 吧!它是一个 Chrome 扩展,鼠标点到哪里就能显示该位置文字使用的字体。

Alfred

Alfred 是另一个 Mac 提高效率的好工具。它可以帮你快速打开某个程序、文件/文件夹、执行定制的搜索等。近几年 Mac 系统自带的 Spotlight 在这方面的功能也有了大幅提高。不过,Alfred 还有很多扩展的功能。

作者:韩国恺。本系列文章以 Addy & Matt 的系列视频  Totally Tooling Tips 的内容为基础重新整理而成,主要介绍一些(前端)开发者喜欢的工具和技巧。

Post Views: 18

除非特别声明,此文章内容采用 知识共享署名 3.0 许可,代码示例采用 Apache 2.0 许可。更多细节请查看我们的 服务条款 。

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Why are HTML attributes important for web development?Why are HTML attributes important for web development?May 12, 2025 am 12:01 AM

HTMLattributesarecrucialinwebdevelopmentforcontrollingbehavior,appearance,andfunctionality.Theyenhanceinteractivity,accessibility,andSEO.Forexample,thesrcattributeintagsimpactsSEO,whileonclickintagsaddsinteractivity.Touseattributeseffectively:1)Usese

What is the purpose of the alt attribute? Why is it important?What is the purpose of the alt attribute? Why is it important?May 11, 2025 am 12:01 AM

The alt attribute is an important part of the tag in HTML and is used to provide alternative text for images. 1. When the image cannot be loaded, the text in the alt attribute will be displayed to improve the user experience. 2. Screen readers use the alt attribute to help visually impaired users understand the content of the picture. 3. Search engines index text in the alt attribute to improve the SEO ranking of web pages.

HTML, CSS, and JavaScript: Examples and Practical ApplicationsHTML, CSS, and JavaScript: Examples and Practical ApplicationsMay 09, 2025 am 12:01 AM

The roles of HTML, CSS and JavaScript in web development are: 1. HTML is used to build web page structure; 2. CSS is used to beautify the appearance of web pages; 3. JavaScript is used to achieve dynamic interaction. Through tags, styles and scripts, these three together build the core functions of modern web pages.

How do you set the lang attribute on the  tag? Why is this important?How do you set the lang attribute on the tag? Why is this important?May 08, 2025 am 12:03 AM

Setting the lang attributes of a tag is a key step in optimizing web accessibility and SEO. 1) Set the lang attribute in the tag, such as. 2) In multilingual content, set lang attributes for different language parts, such as. 3) Use language codes that comply with ISO639-1 standards, such as "en", "fr", "zh", etc. Correctly setting the lang attribute can improve the accessibility of web pages and search engine rankings.

What is the purpose of HTML attributes?What is the purpose of HTML attributes?May 07, 2025 am 12:01 AM

HTMLattributesareessentialforenhancingwebelements'functionalityandappearance.Theyaddinformationtodefinebehavior,appearance,andinteraction,makingwebsitesinteractive,responsive,andvisuallyappealing.Attributeslikesrc,href,class,type,anddisabledtransform

How do you create a list in HTML?How do you create a list in HTML?May 06, 2025 am 12:01 AM

TocreatealistinHTML,useforunorderedlistsandfororderedlists:1)Forunorderedlists,wrapitemsinanduseforeachitem,renderingasabulletedlist.2)Fororderedlists,useandfornumberedlists,customizablewiththetypeattributefordifferentnumberingstyles.

HTML in Action: Examples of Website StructureHTML in Action: Examples of Website StructureMay 05, 2025 am 12:03 AM

HTML is used to build websites with clear structure. 1) Use tags such as, and define the website structure. 2) Examples show the structure of blogs and e-commerce websites. 3) Avoid common mistakes such as incorrect label nesting. 4) Optimize performance by reducing HTTP requests and using semantic tags.

How do you insert an image into an HTML page?How do you insert an image into an HTML page?May 04, 2025 am 12:02 AM

ToinsertanimageintoanHTMLpage,usethetagwithsrcandaltattributes.1)UsealttextforaccessibilityandSEO.2)Implementsrcsetforresponsiveimages.3)Applylazyloadingwithloading="lazy"tooptimizeperformance.4)OptimizeimagesusingtoolslikeImageOptimtoreduc

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool