browser-sync
Advanced tools
Comparing version 0.1.1 to 0.1.3
@@ -62,2 +62,6 @@ #! /usr/bin/env node | ||
if (argv.ghostMode === "false") { | ||
defaultConfig.ghostMode = false; | ||
} | ||
return defaultConfig; | ||
@@ -64,0 +68,0 @@ }, |
{ | ||
"name": "browser-sync", | ||
"description": "Live CSS Reload & Browser Syncing", | ||
"version": "0.1.1", | ||
"version": "0.1.3", | ||
"homepage": "https://github.com/shakyshane/browser-sync", | ||
@@ -65,3 +65,3 @@ "author": { | ||
}, | ||
"keywords": [], | ||
"keywords": ["browser sync", "css", "live reload", "sync"], | ||
"preferGlobal": "true", | ||
@@ -68,0 +68,0 @@ "bin": { |
172
README.md
@@ -1,9 +0,173 @@ | ||
# browser-sync [![Build Status](https://secure.travis-ci.org/shakyshane/browser-sync.png?branch=master)](http://travis-ci.org/shakyshane/browser-sync) | ||
# browser-sync [![Build Status](https://travis-ci.org/shakyShane/browser-sync.png?branch=master)](https://travis-ci.org/shakyShane/browser-sync) | ||
Docs coming soon. | ||
> Keep multiple browsers & devices in sync when building websites. | ||
##Features | ||
1. **Scroll** - I can keep your pages in sync when scrolling. | ||
2. **Forms** - You fill out a form in one browser, I'll copy the data to all the others. | ||
3. **Links** - I'll watch your clicks and make all the browser follow you. | ||
4. **CSS injecting** - I can even watch your CSS files & inject them when they change. | ||
5. **Live Reload** - I can also watch files like HTML and PHP & when they change I can reload all browsers for you. | ||
6. **Built-in Server** - Yep, I can serve static files too. (this is the easiest option actually, explained later) | ||
##When is it useful? | ||
It's pretty useful when used with a single browser, watching a CSS file for changes & injecting it. But the real power comes when you're building responsive sites and using multiple devices/monitors because it can keep all browsers in sync & make your workflow much faster. | ||
##How to install it? | ||
``` | ||
npm install -g browser-sync | ||
``` | ||
####If that doesn't work on a mac, try | ||
``` | ||
sudo npm install -g browser-sync | ||
``` | ||
##How to use it | ||
Browser-sync is a command-line tool & the `-g` from the command above makes it available everywhere on your system. Just `cd` into your website and run one of the commands below. If any further instructions are needed, you'll be notified on the command line. | ||
###Examples | ||
``` | ||
// Watch ALL CSS files in a directory for changes | ||
browser-sync --files "app/css/*.css" | ||
``` | ||
``` | ||
// Watch ALL CSS files for changes with a server | ||
browser-sync --files "app/css/*.css" --server | ||
``` | ||
``` | ||
// Watch ALL CSS files for changes with a server & specify that the base dir should be "app" | ||
browser-sync --files "app/css/*.css" --server "app" | ||
``` | ||
``` | ||
//Watch ALL CSS files for changes with a server & specify that the base dir should be "app" & with browser-sync disabled | ||
browser-sync --files "app/css/*.css" --server "app" --ghostMode false | ||
``` | ||
###Example config file | ||
If you want to, you can provide a config file instead of having to remember all of the command above. Also, a config file allows you to be more specific with options. Here's an example of one that you would put in the root of your project. | ||
``` | ||
module.exports = { | ||
files: "app/css/**/*.css", | ||
host: "192.168.1.1" | ||
ghostMode: { | ||
links: true, | ||
forms: true, | ||
scroll: true | ||
}, | ||
server: { | ||
baseDir: "app" | ||
} | ||
}; | ||
``` | ||
Now, if you called the file `config.js`, you'd simple run | ||
``` | ||
browser-sync --config config.js | ||
``` | ||
##All available options for use in config file | ||
###files - (default: null) | ||
``` | ||
// single file | ||
files: "app/css/style.css" | ||
// multiple files | ||
files: ["app/css/style.css", "app/css/ie.css"] | ||
// multiple files with glob | ||
files: "app/css/*.css" | ||
// multiple globs | ||
files: ["app/css/*.css", "app/**.*.html"] | ||
``` | ||
###debugInfo - (default: true) | ||
``` | ||
// Don't fill my terminal with info | ||
debugInfo: false | ||
// Give me as much info as possible | ||
debugInfo: true | ||
``` | ||
###host - (default: null) | ||
``` | ||
// Leave this set as null & browser-sync will try to figure out the correct IP to use. | ||
host: null | ||
// Override host detection if you know the correct IP to use | ||
host: "192.168.1.1" | ||
``` | ||
###ghostMode - (default: { links: true, forms: true, scroll: true} ) | ||
``` | ||
// Here you can disable each feature individually | ||
ghostMode: { | ||
links: true, | ||
forms: true, | ||
scroll: true | ||
} | ||
// Or switch them all off in one go | ||
ghostMode: false | ||
``` | ||
###server - (default: null) | ||
``` | ||
// Serve files from the app directory | ||
server: { | ||
baseDir: "app" | ||
} | ||
// Serve files from the root directory | ||
server: { | ||
baseDir: "./" | ||
} | ||
``` | ||
###open - (default: true) - when used with server | ||
``` | ||
// Launch a browser window at the correct location | ||
open: true | ||
// Stop the browser from automatically opening | ||
open: false | ||
``` | ||
#Full config file example | ||
Save this as `anything-you-like.js` | ||
``` | ||
module.exports = { | ||
files: "app/css/**/*.css", | ||
debugInfo: true, | ||
host: "192.168.1.1", | ||
ghostMode: { | ||
links: true, | ||
forms: true, | ||
scroll: true | ||
}, | ||
server: { | ||
baseDir: "app" | ||
}, | ||
open: false | ||
}; | ||
``` | ||
Now you can use it by calling it from the command-line | ||
``` | ||
browser-sync --config anything-you-like.js | ||
``` | ||
## License | ||
Copyright (c) 2013 Shane Osbourne | ||
Licensed under the MIT license. | ||
todo - explain that file globs on command line need to be in quotes |
@@ -28,4 +28,10 @@ 'use strict'; | ||
argv.ghostMode = "false"; | ||
var config = setup.getConfig(defaultConfig, argv); | ||
expect(config.server.baseDir).toBe("./"); | ||
// _todo extract to it's own test | ||
expect(config.ghostMode).toBe(false); | ||
}); | ||
@@ -32,0 +38,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
104963
2352
174