css - Stylesheet depends on hostname -


Sorry my english

I'm working on multi-face site I'll change the CSS stylesheet based on the URL given to me, which runs on the Sintra. Like:

  get '/ *' do request.host when 'site1.com' @ style = 'style1' when 'site2.com' @ style = 'style2' end erb : Index end   

then in index.erb view:

    

But if the action file contains a space code, then the content of all pages is "Style 1" or "Style 2". To prevent this, I have to keep the case code in every get the action. I think this is not a Ruby way. Is there any possible way to move "stylish rewriting" into any work, or in this case there are other ways of implementing CSS restructuring? Thank you in advance.

This is a very good reason to use a helpful method. First Add Auxiliary:

  Include helpers in def CSS Host (host) case when host 'Site 1 dot' 'style 1' when 'site2 dot' 'style 2' and end and end  / Pre> 

Then in your index.erb:

  & lt; Link rel = "stylesheet" src = "../// lt;% = include_css (request.host)%> .css" & gt;   

Disclaimer: I do not use ERB, so do not work outside the box. Besides, I do not know if index.erb is a template for all your pages, so you have to put that line in each .arch file that you do.

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -