Skip to content

erikdsi/vue-phoenix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 

Repository files navigation

Vue2.x boilerplate for Phoenix 1.3

Vue2.x+Webpack2 setup for Phoenix

If you want a standalone Vue+Webpack check Webpack

Usage

This is a project template for vue-cli. It is recommended to use yarn or npm 3+ for a more efficient dependency tree.

$ mix phx.new my_project --no-brunch
$ yarn global add vue-cli
$ vue init erikdsi/vue-phoenix my-project
$ cd my-project/assets
$ yarn install

Add the watcher command in your config/dev.exs

watchers: [npm: ["run", "watch", "--prefix", "assets"]]

Setup your app.html.eex and/or index.html.eex:

<!DOCTYPE html>
<html>
  <head>
    <link rel="stylesheet" href="<%= static_path(@conn, "/css/app.css") %>">
  </head>
  <body>
    <div id="app"></div>
    <script src="<%= static_path(@conn, "/js/app.js") %>"></script>
  </body>
</html>

Setup your PageController

def index(conn, _params) do
  render conn, "app.html"
end

And then finally:

$ mix ecto.create
$ mix phx.server

What's Included

  • Webpack + vue-loader for single file Vue components.
  • Babel configured to transpile to js that works in old devices(ios 7)
  • SCSS extraction
  • Pug for templates(former jade)
  • vue-resource So you can make http requests
  • vue-router

Useful links

About

vue-cli template for phoenix

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published