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?

1

1 Answer 1

-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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.