-
-
Save pywebdesign/4be13c02c528e0bd7b91 to your computer and use it in GitHub Desktop.
Very simple rails angular templates server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In the views folder: | |
views/ | |
- user/ | |
- edit.html.erb | |
- show.html.erb | |
- ... | |
Access a template here: | |
example.com/templates/user/edit | |
This way if some day sprocket 3 is integrated in angular-rails-templates, just drag and drop the templates folder in the assets directory, remove the route and voila. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
get "/templates/:name", to: "templates#serve", constraints: { name: /[\/\w\.]+/ } | |
... | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TemplatesController < ApplicationController | |
def serve | |
render "templates/#{params[:name]}", layout: nil | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment