What is less?

Started on the old forum in March 2012 · view the original in the archive · old links redirect here

3 replies · 363 views · started 14 years ago · 1 min read

3 participants
Lil_Kins0 Junior · 10 posts #1

I just came across an article that takes about LESS, a dynamic stylesheet which makes the DRY (Don't Repeat Yourself) Principle possible compared to CSS where you have have to repeat your codes (Static Stylesheet).

Does anyone have any idea about this, cos i don't really get it?

CODING MODE NEVER GETS DEACTIVATED & I NEVER STOP LEARNING.- kinsomicrote

something else Fellow · 2,296 posts #3

by the looks of things less is a javascript function that uses localStorage to enable quicker css i think you can store up to 2mb in local storage (per site) - handy for storing data on peoples computers rather than using Cookies 😉 i use local storage a lot when creating addons for web browsers 🙂

Added after 5 minutes:

the reason why local storage is quicker than cookies is because the server has to read a cookie where as local storage is client side 🙂

so there for storing css on client side means that a user doesnt have to download it from the server once it is set

Added after 6 minutes:

by the looks of things all these mobile sites use local storage: (im not sure if local storage is less mb for mobiles) Google Search Bing Facebook YouTube Yahoo! Front Page Twitter

Twitter mobile also uses app cache which is new to me Appcache Facts

something else Fellow · 2,296 posts #4

oops google mobile uses sessionStorage not localstorage 🙂

This has got me thinking a lot about using javascript more in my scripts for storing data i was kind of put off by phones not supporting javascript (which is very few these days) but you can use things like:

<script type="text/javascript>
var css = localStorage.getItem('css');
if(css==""||css=="undefined")
{
localStorage.setItem('css', '<? include_once("style.php"); ?>'); // might have to do a call for localstroage on style.php also to make sure its blank 
css = localStorage.getItem('css');
}
document.write(css);
</script>
<noscript>
<?
include_once("style.php");
?>
</noscript>

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close