elixir - Phoenix equivalent of Rails' params[:controller] -


i'm trying find phoenix equivalent of rails' params[:controller], can serve stylesheets , javascript files based on controller rendering view.

in rails, this:

<%= stylesheet_link_tag    'application', params[:controller] %>  <%= javascript_include_tag 'application', params[:controller] %> 

source: rails asset pipeline - controller specific assets


i'm trying same thing in phoenix. i'm separating sass files according controllers. maybe this?

<link rel="stylesheet" href="<%= static_path(@conn, "/css/app.css") %>"> <link rel="stylesheet" href="<%= static_path(@conn, "/css/#{@controller}.css") %>">  

you can build class phoenix.controller.controller_module/1 https://github.com/phoenixframework/phoenix/blob/3fc98f8b18095b6d155f5afd824f7c5e24447187/lib/phoenix/controller.ex#l112-l116


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -