browser-sync
Advanced tools
Comparing version 0.7.3 to 0.7.4
@@ -0,3 +1,6 @@ | ||
var browserSync = require("./lib/index"); | ||
console.time("init"); | ||
var files = ["test/fixtures/assets/*", "test/fixtures/*.html"]; | ||
@@ -7,9 +10,17 @@ | ||
server: { | ||
baseDir: "test/fixtures", | ||
directory: true | ||
} | ||
baseDir: "test/fixtures" | ||
}, | ||
open: false, | ||
minify: true | ||
}; | ||
//var clientScript = require("/Users/shakyshane/Sites/browser-sync-modules/browser-sync-client/index"); | ||
// | ||
//browserSync.use("client:script", clientScript.middleware, function (err) { | ||
// console.log(err); | ||
//}); | ||
browserSync.init(files, options, function (err, bs) { | ||
console.timeEnd("init"); | ||
return true; | ||
}); |
@@ -25,6 +25,5 @@ "use strict"; | ||
*/ | ||
function methodName(key) { | ||
module.exports.methodName = function (key) { | ||
return "_merge%sOption".replace("%s", ucfirst(key)); | ||
} | ||
module.exports.methodName = methodName; | ||
}; | ||
@@ -37,9 +36,8 @@ /** | ||
*/ | ||
function transformOption(obj, key, args) { | ||
module.exports.transformOption = function (obj, key, args) { | ||
if (args[key] && typeof obj[key] !== "undefined") { | ||
obj[key] = cliOptions[methodName(key)](obj[key], args[key], args); | ||
obj[key] = cliOptions[exports.methodName(key)](obj[key], args[key], args); | ||
} | ||
return obj; | ||
} | ||
module.exports.transformOption = transformOption; | ||
}; | ||
@@ -52,9 +50,8 @@ /** | ||
*/ | ||
function mergeOptions(defaultConfig, args, allowedOptions) { | ||
module.exports.mergeOptions = function (defaultConfig, args, allowedOptions) { | ||
return allowedOptions | ||
.reduce(function (obj, key) { | ||
return transformOption(obj, key, args); | ||
return exports.transformOption(obj, key, args); | ||
}, defaultConfig); | ||
} | ||
module.exports.mergeOptions = mergeOptions; | ||
}; | ||
@@ -80,5 +77,5 @@ /** | ||
options = _.merge(defaultConfig, userConfig); | ||
options = mergeOptions(defaultConfig, options, exports.allowedOptions); | ||
options = exports.mergeOptions(defaultConfig, options, exports.allowedOptions); | ||
} else { | ||
options = mergeOptions(defaultConfig, args, exports.allowedOptions); | ||
options = exports.mergeOptions(defaultConfig, args, exports.allowedOptions); | ||
options.files = cliOptions._mergeFilesOption(args.files, options.exclude); | ||
@@ -103,2 +100,3 @@ } | ||
.version(version) | ||
.usage("<command> [options]") | ||
.option("--files", "File paths to watch") | ||
@@ -112,2 +110,18 @@ .option("--server", "Run a Local server (uses your cwd as the web root)") | ||
program | ||
.on("--help", function(){ | ||
console.log(" Server Example:"); | ||
console.log(" ---------------"); | ||
console.log(" Use current directory as root & watch CSS files"); | ||
console.log(""); | ||
console.log(" $ browser-sync start --server --files=\"css/*.css\""); | ||
console.log(""); | ||
console.log(" Proxy Example:"); | ||
console.log(" --------------"); | ||
console.log(" Proxy `localhost:8080` & watch CSS files"); | ||
console.log(""); | ||
console.log(" $ browser-sync start --proxy=\"localhost:8080\" --files=\"css/*.css\""); | ||
console.log(""); | ||
}); | ||
program | ||
.command("init") | ||
@@ -125,3 +139,7 @@ .description("Creates a default config file") | ||
program.parse(argv); | ||
if (!args._.length) { | ||
program.help(); | ||
} | ||
}; | ||
module.exports = { | ||
debugInfo: true, | ||
injectFileTypes: ["css", "png", "jpg", "jpeg", "svg", "gif", "webp"], | ||
minify: true, | ||
logConnections: false, | ||
host: null, | ||
@@ -54,4 +56,5 @@ ghostMode: { | ||
"avi", | ||
"swf" | ||
"swf", | ||
"scss" | ||
] | ||
}; |
@@ -23,4 +23,6 @@ "use strict"; | ||
"client:connected": function (options, data) { | ||
var msg = messages.browser.connection(utils.getUaString(data.ua)); | ||
utils.log(msg, options, false); | ||
if (options.logConnections) { | ||
var msg = messages.browser.connection(utils.getUaString(data.ua)); | ||
utils.log(msg, options, false); | ||
} | ||
}, | ||
@@ -27,0 +29,0 @@ "open": function (options, data) { |
@@ -116,12 +116,5 @@ "use strict"; | ||
* @param base | ||
* @param directory | ||
*/ | ||
addDirectory: function (app, base, directory) { | ||
var dirBase = base; | ||
if (directory) { | ||
if (typeof directory === "string") { | ||
dirBase = filePath.resolve(directory); | ||
} | ||
app.use(connect.directory(dirBase, {icons:true})); | ||
} | ||
addDirectory: function (app, base) { | ||
app.use(connect.directory(base, {icons:true})); | ||
} | ||
@@ -172,8 +165,8 @@ }; | ||
if (directory) { | ||
utils.addDirectory(app, baseDir, server.directory); | ||
} | ||
utils.addBaseDir(app, baseDir, index); | ||
if (directory) { | ||
utils.addDirectory(app, baseDir); | ||
} | ||
@@ -180,0 +173,0 @@ staticServer = http.createServer(app); |
@@ -43,3 +43,3 @@ "use strict"; | ||
controlPanel | ||
.launchControlPanel(options, this.getPlugin("client:script"), cp) | ||
.launchControlPanel(options, this.getPlugin("client:script")(options), cp) | ||
.listen(ports.controlPanel); | ||
@@ -46,0 +46,0 @@ |
@@ -62,4 +62,8 @@ "use strict"; | ||
io.set("log level", 0); | ||
if (options.minify) { | ||
io.set("browser client minification", true); | ||
io.set("browser client gzip", true); | ||
} | ||
exports.socketConnection(events, options, io, emitter); | ||
return io; | ||
}; |
{ | ||
"name": "browser-sync", | ||
"description": "Live CSS Reload & Browser Syncing", | ||
"version": "0.7.3", | ||
"version": "0.7.4", | ||
"homepage": "https://github.com/shakyshane/browser-sync", | ||
@@ -44,3 +44,3 @@ "author": { | ||
"resp-modifier": "0.0.4", | ||
"browser-sync-client": "0.0.4", | ||
"browser-sync-client": "0.0.5", | ||
"commander": "~2.1.0", | ||
@@ -47,0 +47,0 @@ "browser-sync-control-panel": "0.0.3" |
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
2144
208534
53
+ Addedalign-text@0.1.4(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedbrowser-sync-client@0.0.5(transitive)
+ Addedcamelcase@1.2.1(transitive)
+ Addedcenter-align@0.1.3(transitive)
+ Addedcliui@2.1.0(transitive)
+ Addedclone-stats@0.0.1(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addeddecamelize@1.2.0(transitive)
+ Addedfind-index@0.1.1(transitive)
+ Addedglob@4.5.3(transitive)
+ Addedglob-stream@3.1.18(transitive)
+ Addedglob-watcher@0.0.6(transitive)
+ Addedglob2base@0.0.12(transitive)
+ Addedgraceful-fs@2.0.3(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedis-buffer@1.1.6(transitive)
+ Addedkind-of@3.2.2(transitive)
+ Addedlazy-cache@1.0.4(transitive)
+ Addedlongest@1.0.1(transitive)
+ Addedmap-stream@0.1.0(transitive)
+ Addedminimatch@2.0.10(transitive)
+ Addedmkdirp@0.3.5(transitive)
+ Addedobject-keys@0.4.0(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedordered-read-streams@0.1.0(transitive)
+ Addedreadable-stream@1.0.34(transitive)
+ Addedrepeat-string@1.6.1(transitive)
+ Addedright-align@0.1.3(transitive)
+ Addedsource-map@0.5.7(transitive)
+ Addedthrough2@0.4.20.6.5(transitive)
+ Addeduglify-js@2.8.29(transitive)
+ Addeduglify-to-browserify@1.0.2(transitive)
+ Addedunique-stream@1.0.0(transitive)
+ Addedvinyl@0.2.3(transitive)
+ Addedvinyl-fs@0.1.4(transitive)
+ Addedwindow-size@0.1.0(transitive)
+ Addedwordwrap@0.0.2(transitive)
+ Addedwrappy@1.0.2(transitive)
+ Addedxtend@2.1.24.0.2(transitive)
+ Addedyargs@3.10.0(transitive)
- Removedbrowser-sync-client@0.0.4(transitive)
Updatedbrowser-sync-client@0.0.5