1

I need to have same html for different client as

<body>
<div class="init">test</div>
<div class="init1"> test 1</div>
</body>

Using Ruby on rail framework, My css need to change based on client as
for client1,

.init {color:green}

around 200 properties

for client2,

.init {color:red}

around 200 different properties

These css properties can be customised by the client in the view.
How to make this

Whether to store in database or getting input from client creating a seperate css file or any other idea?

Mr. Alien
  • 153,751
  • 34
  • 298
  • 278
Dheena
  • 117
  • 9

1 Answers1

-1

You can use less and Less.js and compile the style.css from an array of the users settings, or you can replace them dynamically with php.

// style.css
.color {color : %color_1%}

// php
$css = file_get_content('style.css');
foreach($params as $key => $value) {
    $css = str_replace('%' + $key + '%', $value);
}

You can either save it as a new style.css, or show it inline in block or get it dynamically