This a basic bare-bone setup for new Phoenix projects.
Elixir Phoenix, Webpack, Stylus and React with Hot Module Replacement.
Extend it, build new cool things with it – whatever the hell you want!
This guy: Letmecode
Several reasons.
-
Brunch, the default Phoenix build-tool, is about as useful as a sandbox in the desert. But hey, at least it's also annoying.
-
React and Phoenix are a golden match, but the former seems to work best with a proper Webpack setup. I was sick of building one for each project, so I build a general setup to start from.
Fair enough, don't use it then. Oh, and don't forget to light yourself on fire. ‡
git clone https://github.com/odiumediae/webpacker.git
cd webpacker
mix webpacker.setup
Note You don't need to install the npm modules manually anymore, webpacker.setup
should do that automatically. For convenience the setup uses Yarn, if installed, and a fallback to npm when it's not installed. You can, of course, still skip webpacker.setup
, if you want more control by manually cd
ing into ./assets
and running npm install
, but I'm too lazy to do that ;)
iex -S mix phoenix.server
- Rebuild with Phoenix 1.3.0 final
- Update some npm dependencies
- Use 'App' as main namespace module, as it is more generic
- bump Webpack verion to 3.4.0
- bump Phoenix version to v1.3.0-rc.3
- bump Elixir version to 1.5
- remove redundant exclamation mark
- update "ebpack
- remove redundant babel config settings from
webpack.config.js
- update
package.json
- bump Phoenix dependency from 1.3.0-rc.1 to 1.3.0-rc.2
- reverse sequence of the version history, so the upmost is always the first one
- remove superfluous
do
inwebpacker.setup
example - correct some typos in REAMDE.md
- removed [email protected] due to a bug that prevents assets being copied to priv/static correctly and used @2.1.6 instead
- removed superfluous copy of old assets folder
- removed
ecto.migrate
fromwebpacker.setup
task in mix.exs
- generated a completely new Phoenix app (1.3.0-rc.1), in order to minimise inconsistencies bewteen new conventions and how things worked in Phoenix 1.2.x, particularly in regard to folder structure and contexts. You can read up on that in a few minutes here and here or simply watch @chrismccord's nice keynote from the Lonestar ElixirConf 2017
- added the mix task
webpacker.frontend
and plugged it intowebpacker.setup
in order to automatically install npm modules along with the rest of the setup. Just runwebpacker.setup
after cloning the repo and you can runiex -S mix phx.server
- renamed the wrongly named
iex.exs
to.iex.exs
and added some aliases so you don't have to alias the most used modules when trying out how to do stuff iwthin the REPL. You can simply add or remove imports, etc. to cater your needs
‡ Don't actually do that, it freaking hurts! ↩