Best way to handle dynamic css in a rails app

前端 未结 5 936
攒了一身酷
攒了一身酷 2020-12-13 00:53

I\'m researching a problem for handling dynamic css in a rails app. Within the app, individual users and/or groups of users can have customized look and feel that is accomp

5条回答
  •  南笙
    南笙 (楼主)
    2020-12-13 01:24

    I had a similar problem - but needed to serve the modified CSS only once. I store a couple of constants in a module 'Site' - which I can then use as constants in CSS or as constants throughout the Rails application. I auto-generate the CSS files whenever the Rails application restarts and the CSS input files were modified.

    You could do something similar, but reference symbolic names in site_settings.rb and then fetch those on a per-user basis from MongoDB

    http://unixgods.org/~tilo/Ruby/Using_Variables_in_CSS_Files_with_Ruby_on_Rails.html

提交回复
热议问题