https://github.com/cohesivelabs/webpackstaticplug
Phoenix plug to proxy the webpack dev server in order to enable HMR and faster build times during development
https://github.com/cohesivelabs/webpackstaticplug
elixir elixir-lang elixir-phoenix plug webpack webpack-dev-server
Last synced: 3 months ago
JSON representation
Phoenix plug to proxy the webpack dev server in order to enable HMR and faster build times during development
- Host: GitHub
- URL: https://github.com/cohesivelabs/webpackstaticplug
- Owner: cohesivelabs
- License: mit
- Created: 2018-05-14T03:32:48.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-05-17T20:46:39.000Z (over 7 years ago)
- Last Synced: 2025-10-07T01:22:30.822Z (3 months ago)
- Topics: elixir, elixir-lang, elixir-phoenix, plug, webpack, webpack-dev-server
- Language: Elixir
- Homepage:
- Size: 11.7 KB
- Stars: 3
- Watchers: 0
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# WebpackStatic
[](https://travis-ci.org/jmartin84/WebpackStaticPlug)
Phoenix plug to proxy a locally running instance of the webpack dev server.
This plug will only serve assets when the env parameter has the value of `:dev`.
Phoenix will be allowed a chance to resolve any assets not resolved by webpack.
## Installation
```elixir
defp deps do
[
{:WebpackStaticPlug, "~> 0.1.1"}
]
end
```
And run:
$ mix deps.get
## Usage
Add WebpackStatic.Plug as a plug in the phoenix project's endpoint.
## Arguments
* **port** - *(required)* The port that the webpack dev server is listening on.
* **webpack_assets** - *(required)* a list of the paths in the static folder that webpack will for serve. The plug will ignore requests to any other path.
* **env** - *(required)* the current environment the project is running under.
* **manifest_path** - *(optional)* relative path that will resolve from the static folder of the webpack manifest file.
## Example
in `endpoint.ex`
```elixir
plug WebpackStatic.Plug,
port: 9000, webpack_assets: ~w(css fonts images js),
env: Mix.env, manifest_path: "/manifest.json"
```