-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from oneut/add_local_web_server_with_webpack_ex…
…ample Add local web server with webpack example
- Loading branch information
Showing
7 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,27 @@ | ||
# Local Web Server with webpack Example | ||
|
||
This is a example that monitors the standard output of webpack and performs Live Reload to the local web server. | ||
|
||
## Doing | ||
Live Reload | ||
Source website is local web server. | ||
Set webpack task. | ||
Command | ||
Execute webpack watch. | ||
Watch stdouts. | ||
`Entrypoint main = bundle.js` | ||
If stdout matches, `lrp` fires Live Reload. | ||
Set local web server task. | ||
Command | ||
Start local web server. | ||
use [http-server](https://github.com/indexzero/http-server) | ||
|
||
## Ready | ||
``` | ||
npm install | ||
``` | ||
|
||
## Start | ||
``` | ||
lrp start | ||
``` |
Binary file added
BIN
656 KB
examples/local-web-server-with-webpack/local-web-server-with-webpack.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,18 @@ | ||
proxy: | ||
host: "localhost:9500" | ||
source: | ||
host: "localhost:8080" | ||
tasks: | ||
webpack: | ||
commands: | ||
watch: | ||
execute: "npm run webpack:start" | ||
watch_stdouts: | ||
- "Entrypoint main = bundle.js" | ||
local-web-server: | ||
monitor: | ||
paths: | ||
- "./public/index.html" | ||
commands: | ||
http-server: | ||
execute: "npm run hs:start -- -p 8080" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,18 @@ | ||
{ | ||
"name": "local-web-server", | ||
"version": "1.0.0", | ||
"description": "Live reload local web server", | ||
"scripts": { | ||
"hs:start": "hs", | ||
"webpack:start": "webpack --watch --mode=development" | ||
}, | ||
"author": "", | ||
"license": "MIT", | ||
"dependencies": { | ||
"http-server": "^0.11.1" | ||
}, | ||
"devDependencies": { | ||
"webpack": "^4.4.1", | ||
"webpack-cli": "^2.0.13" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,6 @@ | ||
<html> | ||
<body> | ||
Hello Local Web Server with webpack. | ||
<script src="assets/bundle.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1 @@ | ||
alert("transpiled!"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,7 @@ | ||
module.exports = { | ||
entry: "./src/assets/app.js", | ||
output: { | ||
path: __dirname "/public/assets", | ||
filename: "bundle.js" | ||
} | ||
}; |