Precompiled Single-Page-Apps in Phoenix App

后端 未结 2 742
误落风尘
误落风尘 2021-02-04 13:22

I have a pre-compiled ember.js app (which fronted-js-framework shouldn\'t matter here), which basically consists of a folder with a index.html file, and a few js/css assets.

相关标签:
2条回答
  • 2021-02-04 13:47

    I think easiest way to replace web/templates/layout/app.html.eex with your index html and change assets path inside with <%= static_path(@conn, "/js/app.js") %> helpers to grab your ember app js file from static folder.

    Router part:

    scope "/", Chat do
      pipe_through :browser
      get "/", PageController, :index
    end
    

    And inside action render conn.

    0 讨论(0)
  • 2021-02-04 13:49

    Your setup should just work. There is only one caveat: every time you change something in lib, you must restart your application.

    The only directory that is code reloaded on requests is web. In fact, that's the only difference between lib and web directories. That's why you put long running processes and supervisor in lib, because there is no need to code reload them, and everything else goes in web.

    0 讨论(0)
提交回复
热议问题