Starspire
Starspire

Reputation: 272

Rails 4 - Stylesheets from public folder

I have a problem with including stylesheets and javascript files from public folder into my project.

I do it in following way:

<%= stylesheet_link_tag '/public/dist/css/AdminLTE.min.css' %> 

Unfortunatelly I've got an error:

ActionController::RoutingError (No route matches [GET] "/public/dist/css/AdminLTE.min.css")

Can u tell me how to solve this?

Upvotes: 3

Views: 4452

Answers (1)

Alserda
Alserda

Reputation: 4764

Remove the '/public/' path.

<%= stylesheet_link_tag '/dist/css/AdminLTE.min.css' %> 

Files under public don't need the /public/ path. An example are your error pages that can be reached by localhost:3000/404.html

Enabling this in production requires you to enable it in your environment file.

In production.rb

config.serve_static_assets = true

Upvotes: 5

Related Questions