dimanche 18 septembre 2016

Rails assets, css, javascript all broken on production mode?

i am using rails 4.2 and developing my rails app with windows 7 64 bits, everything work fine on development mode, but once i tried to run my app on production mode, my app layout, css and javascript all broken, i believe it has something to do with asset pipeline, but i don't quite understand, kindly give me some help.

here is my asset structure under vendor/assets folder:

  • public_assets
    • font
    • img
    • css
    • js
    • sass
    • vendor
    • vid
  • Static_Dev
    • assets
      • img
        • flags
        • avatars
      • css
      • js
        • libs
        • views
      • fonts

and i called my assets in these files :

admin.css
admin.js
public.css
public.js

i also added this to my assets.rb :

Rails.application.config.assets.precompile += %w( public.css )
Rails.application.config.assets.precompile += %w( admin.css )
Rails.application.config.assets.precompile += %w( admin.js )
Rails.application.config.assets.precompile += %w( public.js )

and this to application.rb

config.assets.paths += Dir["#{Rails.root}/vendor/public-assets/*"].sort_by { |dir| -dir.size }
config.assets.paths += Dir["#{Rails.root}/vendor/Static_Dev/*"].sort_by { |dir| -dir.size }

please advice what i missed here?

Aucun commentaire:

Enregistrer un commentaire