{"id":3070,"date":"2017-07-12T11:00:42","date_gmt":"2017-07-12T16:00:42","guid":{"rendered":"http:\/\/cssnewbie.com\/?p=2341"},"modified":"2017-07-12T11:00:42","modified_gmt":"2017-07-12T16:00:42","slug":"a-solid-tool-for-web-dev-browser-sync-on-a-mac","status":"publish","type":"post","link":"https:\/\/cssdeck.com\/blog\/a-solid-tool-for-web-dev-browser-sync-on-a-mac\/","title":{"rendered":"A Solid Tool for Web Dev &#8211; Browser-Sync on a Mac"},"content":{"rendered":"<h5>What is Browser-Sync<\/h5>\n<p>Browser-sync is a tool that helps synchronize your browser with any updates you make to the text file immediately after saving. Once you start coding more often, you get acclimated to adding code, refreshing the browser, and saving the files. Refreshing the browser manually can get laborious and just takes more time to do something you need to repeat anyway. Browser-sync is a great tool to close that gap so you don\u2019t have to worry about refreshing your browser.<\/p>\n<p>How does it work? It basically links your text files to your browser window so that every time you save the file, it refreshes the browser window. Interestingly enough, it only refreshes after saving changes to the HTML file.<\/p>\n<p>Personally I tried to learn this myself and was so confused by the articles that were out there. This probably has to do something with my limited understanding of how to use tools like Terminal. If you don\u2019t already know what <a href=\"https:\/\/en.wikipedia.org\/wiki\/Terminal_(macOS)\">Terminal <\/a>\u00a0is, it\u2019s basically a way to control the operating system but in a really bare bones fashion. In case the original layout and color scheme is too much for you, you can change it and make it easier on the eyes. Keep in mind that this is only for Apple Operating Systems.<\/p>\n<h5>Using Browser-Sync<\/h5>\n<p>Now, we\u2019re going to go over how to use Browser-Sync successfully. Here are the instructions:<\/p>\n<p>1. Copy and paste the following code into the tag of your HTML file<br \/>\n<a href=\"https:\/\/cssdeck.com\/blog\/wp-content\/uploads\/2017\/06\/Screen-Shot-2017-06-03-at-18.15.19.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-2342 \" src=\"https:\/\/cssdeck.com\/blog\/wp-content\/uploads\/2017\/06\/Screen-Shot-2017-06-03-at-18.15.19.png\" alt=\"Browser Sync HTML Code\" width=\"489\" height=\"105\" \/><\/a><\/p>\n<p>2. Use TERMINAL to navigate into the folder that you want the Browser-Sync to work for by using this phrase: cd [enter path] . If you don\u2019t know if you\u2019re in the right place, type \u201cls\u201d and TERMINAL will list the files that are currently in the file that you\u2019ve landed in.<\/p>\n<p><a href=\"https:\/\/cssdeck.com\/blog\/wp-content\/uploads\/2017\/06\/Screen-Shot-2017-06-03-at-18.04.19.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-2345 \" src=\"https:\/\/cssdeck.com\/blog\/wp-content\/uploads\/2017\/06\/Screen-Shot-2017-06-03-at-18.04.19.png\" alt=\"Navigating in Terminal\" width=\"450\" height=\"71\" \/><\/a><\/p>\n<p>3. Use TERMINAL to start up Browser-Sync by typing the following all in one line:<br \/>\nbrowser-sync start &#8211;server &#8211;files &#8220;stylesheets\/*.css, *.html&#8221;<\/p>\n<p>4. If the connection is not happening, make sure &#8220;HOST&#8221; NUMBER in the script (part of the same code copied and pasted into the tag of the HTML file. Hint: where it says \u201cHOST:\u201d) is the same as what&#8217;s in the address bar of the window that pops up after the previous command line. If it isn&#8217;t the same, change the number to make it the same, then save the file. Afterwards, refresh the corresponding browser tab. It will stay connected and refresh any time you save the HTML file.<\/p>\n<div id=\"attachment_2343\" class=\"thumbnail wp-caption aligncenter\" style=\"width: 589px\"><a href=\"https:\/\/cssdeck.com\/blog\/wp-content\/uploads\/2017\/06\/Screen-Shot-2017-06-03-at-18.15.03.png\"><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-2343 size-full\" src=\"https:\/\/cssdeck.com\/blog\/wp-content\/uploads\/2017\/06\/Screen-Shot-2017-06-03-at-18.15.03.png\" alt=\"Address Bar image\" width=\"589\" height=\"86\" \/><\/a><div class=\"caption\"><p class=\"wp-caption-text\">Address Bar image<\/p><\/div><\/div>\n<p><a href=\"https:\/\/cssdeck.com\/blog\/wp-content\/uploads\/2017\/06\/Screen-Shot-2017-06-03-at-18.15.19-copy.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-2344 \" src=\"https:\/\/cssdeck.com\/blog\/wp-content\/uploads\/2017\/06\/Screen-Shot-2017-06-03-at-18.15.19-copy.png\" alt=\"Browser Sync Host Number in Code\" width=\"563\" height=\"121\" \/><\/a><\/p>\n<h5>Conclusion<\/h5>\n<p>I used several articles to learn how to use Browser-sync. One comes from the actual people who created Browser-sync [<a title=\"Browser Sync Main Site\" href=\"https:\/\/www.browsersync.io\/docs\/command-line\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/www.browsersync.io\/docs\/command-line<\/a>], one from Stackoverflow [<a title=\"StackOverflow Forum on Browser Sync\" href=\"http:\/\/stackoverflow.com\/questions\/28962528\/browsersync-cannot-get\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/stackoverflow.com\/questions\/28962528\/browsersync-cannot-get<\/a>], and another from a blog [<a title=\"A Blog Entry on Browser Sync\" href=\"http:\/\/damonbauer.me\/browsersync\/\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/damonbauer.me\/browsersync\/<\/a>]. If you\u2019re new to this, it can be daunting but don\u2019t let that stop you from improving your workflow. Happy coding!<\/p>\n<div class=\"wp-socializer wpsr-share-icons \" data-lg-action=\"show\" data-sm-action=\"show\" data-sm-width=\"768\" ><h3>Share and Enjoy !<\/h3><div class=\"wpsr-si-inner\"><div class=\"wpsr-counter wpsrc-sz-32px\" style=\"color:#000\"><span class=\"scount\"><span data-wpsrs=\"\" data-wpsrs-svcs=\"facebook,twitter,linkedin,pinterest,print,pdf\">0<\/span><\/span><small class=\"stext\">Shares<\/small><\/div><div class=\"socializer sr-popup sr-32px sr-circle sr-opacity sr-pad sr-count-1 sr-count-1\"><span class=\"sr-facebook\"><a rel=\"nofollow\" href=\"https:\/\/www.facebook.com\/share.php?u=\" target=\"_blank\"  title=\"Share this on Facebook\"  style=\"color: #ffffff\" ><i class=\"fab fa-facebook-f\"><\/i><span class=\"ctext\"><span data-wpsrs=\"\" data-wpsrs-svcs=\"facebook\">0<\/span><\/span><\/a><\/span>\n<span class=\"sr-twitter\"><a rel=\"nofollow\" href=\"https:\/\/twitter.com\/intent\/tweet?text=%20-%20%20\" target=\"_blank\"  title=\"Tweet this !\"  style=\"color: #ffffff\" ><i class=\"fab fa-twitter\"><\/i><\/a><\/span>\n<span class=\"sr-linkedin\"><a rel=\"nofollow\" href=\"https:\/\/www.linkedin.com\/sharing\/share-offsite\/?url=\" target=\"_blank\"  title=\"Add this to LinkedIn\"  style=\"color: #ffffff\" ><i class=\"fab fa-linkedin-in\"><\/i><\/a><\/span>\n<span class=\"sr-pinterest\"><a rel=\"nofollow\" href=\"https:\/\/www.pinterest.com\/pin\/create\/button\/?url=&amp;media=&amp;description=\" target=\"_blank\"  title=\"Submit this to Pinterest\"  style=\"color: #ffffff\" data-pin-custom=\"true\"><i class=\"fab fa-pinterest\"><\/i><span class=\"ctext\"><span data-wpsrs=\"\" data-wpsrs-svcs=\"pinterest\">0<\/span><\/span><\/a><\/span>\n<span class=\"sr-print\"><a rel=\"nofollow\" href=\"https:\/\/www.printfriendly.com\/print?url=\" target=\"_blank\"  title=\"Print this article \"  style=\"color: #ffffff\" ><i class=\"fa fa-print\"><\/i><\/a><\/span>\n<span class=\"sr-pdf\"><a rel=\"nofollow\" href=\"https:\/\/www.printfriendly.com\/print?url=\" target=\"_blank\"  title=\"Convert to PDF\"  style=\"color: #ffffff\" ><i class=\"fa fa-file-pdf\"><\/i><\/a><\/span><\/div><\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>What is Browser-Sync<\/p>\n<p>Browser-sync is a tool that helps synchronize your browser with any updates you make to the text file immediately after saving. Once you start coding more often, you get acclimated to adding code, refreshing the browser, and saving [&#8230;]<\/p>\n<p><a class=\"more-link article\" href=\"https:\/\/cssdeck.com\/blog\/a-solid-tool-for-web-dev-browser-sync-on-a-mac\/\" title=\"Click to read 'A Solid Tool for Web Dev &#8211; Browser-Sync on a Mac'\">Read Article<\/a><\/p>\n","protected":false},"author":18,"featured_media":2921,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[168,192,193],"tags":[],"_links":{"self":[{"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/posts\/3070"}],"collection":[{"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/users\/18"}],"replies":[{"embeddable":true,"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/comments?post=3070"}],"version-history":[{"count":0,"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/posts\/3070\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/media\/2921"}],"wp:attachment":[{"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/media?parent=3070"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/categories?post=3070"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/tags?post=3070"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}