Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use opn to open the default browser in a cross-platform way #4

Merged
merged 1 commit into from
Jul 17, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"file-loader": "^0.9.0",
"html-webpack-plugin": "^2.22.0",
"json-loader": "^0.5.4",
"opn": "^4.0.2",
"postcss-loader": "^0.9.1",
"rimraf": "^2.5.3",
"style-loader": "^0.13.1",
Expand Down
8 changes: 2 additions & 6 deletions scripts/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ var webpack = require('webpack');
var WebpackDevServer = require('webpack-dev-server');
var config = require('../webpack.config.dev');
var execSync = require('child_process').execSync;
var opn = require('opn');

new WebpackDevServer(webpack(config), {
publicPath: config.output.publicPath,
Expand All @@ -39,10 +40,5 @@ new WebpackDevServer(webpack(config), {
}
console.log('Listening at http://localhost:3000/');

try {
execSync('ps cax | grep "Google Chrome"');
execSync('open -a "Google Chrome" http://localhost:3000/');
} catch(e) {
// Do nothing if Chrome isn't opened or cannot be opened
}
opn('http://localhost:3000/');
});