Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>As someone who uses php quite a bit and has been using Sass for a few months:</p> <ol> <li>What is the value of using SASS or LESS over Php?</li> </ol> <p>In these pre-processors, all the work has already been done for you. You could feasibly achieve the same goals using php you wrote yourself, but it would be a waste of time. Months, perhaps even years, of work, testing and evaluation have gone into Sass and Less, to name two. Why duplicate that work?</p> <p>Many IDE's already support syntax-highlighting for .scss files, for example, making it easier to read and write the code.</p> <p>You don't need a server to run Sass or Less, making them quite portable. Sass does require Ruby, but Less only requires javascript, ie: it will run anywhere.</p> <p>Using something like Sass will make you think in a very structured way about your css, and encourage some good habits.</p> <ol> <li>If I were to use SASS or LESS, what's the best way to integrate values from the database?</li> </ol> <p>I've never done anything like that, but here's how I might approach it. Have a table in the database dedicated to storing the variables, start off with just an id, a class-name, and a value stored as a text string, be it a measurement, a hex colour, whatever you need.</p> <p>Whenever you add a new definition to the table, have a script run which updates a .scss file (if you're using Sass), called something like db_values.scss Simply write in text which lists a big bunch of variables and their values, in the syntax required by the preprocessor.</p> <p>In your main pre-processor file, import this generated file, it won't give you bloated style-sheets, the resulting css will only use the variables it needs.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload