Skip to content

Phoenix plug to proxy the webpack dev server in order to enable HMR and faster build times during development

License

Notifications You must be signed in to change notification settings

cohesivelabs/WebpackStaticPlug

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WebpackStatic

Build Status

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

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

  plug WebpackStatic.Plug,
        port: 9000, webpack_assets: ~w(css fonts images js),
        env: Mix.env, manifest_path: "/manifest.json"

About

Phoenix plug to proxy the webpack dev server in order to enable HMR and faster build times during development

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages