Phoenix comes enabled with brunch by default, but it can easily be used with webpack instead. Here is a (very simple) sample webpack setup intended for use with React and SCSS.
To run after cloning, run npm i
and then follow the steps in Starting Phoenix.
- Start a new project without brunch:
mix phoenix.new . --no-brunch
npm init
- Install npm dependencies:
npm i --save-dev autoprefixer-loader babel-core babel-loader css-loader node-sass sass-loader style-loader webpack
. - Add webpack to the watchers array near the top of
config/dev.exs
:watchers: [{Path.expand("node_modules/webpack/bin/webpack.js"), ["--watch", "--colors", "--progress"]}]
- Copy over
webpack.config.js
- Create a file at
web/static/js/index.jsx
or copy over the example contents ofweb/static/js
from this repo
Most of this follows closely:
To start your Phoenix app:
- Install dependencies with
mix deps.get
- Create and migrate your database with
mix ecto.create && mix ecto.migrate
- Start Phoenix endpoint with
mix phoenix.server
Now you can visit localhost:4000
from your browser.
Ready to run in production? Please check our deployment guides.
- Official website: http://www.phoenixframework.org/
- Guides: http://phoenixframework.org/docs/overview
- Docs: http://hexdocs.pm/phoenix
- Mailing list: http://groups.google.com/group/phoenix-talk
- Source: https://github.com/phoenixframework/phoenix