Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
Please sir, can I have LESS ?
Old 05-26-2012, 10:37 AM Please sir, can I have LESS ?
TWD
TWD's Avatar
King Spam Talker

Posts: 1,296
Trades: 0
Has anyone tried LESS ?

http://lesscss.org/

I am intrigued.
__________________

Please login or register to view this content. Registration is FREE
"Order a PEBBLE Smart Watch for Bluetooth connection to your iPhone or Android" - 100% Waterproof - 7+ days Battery Charge - High Res Outdoor Readable - Vibrating Alert - Incoming Caller ID
TWD is online now
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-27-2012, 07:30 PM Re: Please sir, can I have LESS ?
Physicsguy's Avatar
404 - Title not found

Posts: 1,061
Name: Scott Kaye
Location: Ontario
Trades: 0
I've seen this around before, and it certainly looks very cool. My first concern though, is how it will fall back with browsers with JS disabled.
__________________

Please login or register to view this content. Registration is FREE
Physicsguy is offline
Reply With Quote
View Public Profile Visit Physicsguy's homepage!
 
Old 05-29-2012, 08:39 PM Re: Please sir, can I have LESS ?
NullPointer's Avatar
Will Code for Food

Posts: 2,883
Name: Matt
Location: Irvine, CA
Trades: 0
Quote:
Originally Posted by Physicsguy View Post
I've seen this around before, and it certainly looks very cool. My first concern though, is how it will fall back with browsers with JS disabled.
I don't see the point in deploying it client side since it really only exists to make developer's lives easier. Just compile it to css and sidestep the JS issues all together.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is offline
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 06-02-2012, 08:21 PM Re: Please sir, can I have LESS ?
Physicsguy's Avatar
404 - Title not found

Posts: 1,061
Name: Scott Kaye
Location: Ontario
Trades: 0
Quote:
Originally Posted by NullPointer View Post
I don't see the point in deploying it client side since it really only exists to make developer's lives easier. Just compile it to css and sidestep the JS issues all together.
To me, that's too much of a hassle. It would work, but it would defeat the purpose of using LESS in the first place. The variables in LESS make CSS so much easier, but usually what I do to avoid that is use a style.php, and include() that in a <style> tag. Messy, but it works with PHP variables in the CSS code.

EDIT: Something like this:

Normal style.css:
Code:
body{
background:$css_mainColor1;
color:$css_textColor1;
font-size:$css_mainFontSize;
}
As you can see, those PHP variables won't work, even if they exist. .css files aren't parsed as PHP (but you could probably make it so they are in .htaccess). Using this simple fix:

Renamed to style.php:
Code:
body{
background:$css_mainColor1;
color:$css_textColor1;
font-size:$css_mainFontSize;
}
Included in index.php or wherever you need styling (maybe a main header.php file?)

PHP Code:
$css_mainColor1 '#000';
$css_textColor1 '#fff';
$css_mainFontSize '14px';
echo 
'<style type="text/css">';
include(
'style.php');
echo 
'</style>'
To make the variables work.
__________________

Please login or register to view this content. Registration is FREE

Last edited by Physicsguy; 06-02-2012 at 08:25 PM..
Physicsguy is offline
Reply With Quote
View Public Profile Visit Physicsguy's homepage!
 
Old 06-06-2012, 03:09 PM Re: Please sir, can I have LESS ?
NullPointer's Avatar
Will Code for Food

Posts: 2,883
Name: Matt
Location: Irvine, CA
Trades: 0
Quote:
The variables in LESS make CSS so much easier, but usually what I do to avoid that is use a style.php, and include() that in a <style> tag. Messy, but it works with PHP variables in the CSS code.
I'm not sure I understand. How does using a client side less implementation (ie serving the raw less file and the js parser) allow you to use PHP variables in your style sheet? Regardless of whether your less code is compiled server side or client side it is still completely distinct from PHP.

Having your .css files parsed by PHP or (worse) sticking your entire stylesheet your html output increases server load. If all you want is variables, just use less and compile it to css. If you have styles you want to override with user settings in PHP, just use a static css file and output the user settings in your header.

style.css
Code:
body {
     background-color:#fff;
     color:#000;
     font-size:14px;
}
PHP code to override default styles
PHP Code:
<?php
//call this function inside <head>...</head>
function custom_styles()
{
     
$custom_bg '#000';
     
$custom_color '#fff';
?>
<style type="text/css">body { background-color: <?php echo $custom_bg?>; color: <?php echo $custom_color?>; }</style>
<?php
}
?>
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Last edited by NullPointer; 06-08-2012 at 04:48 PM..
NullPointer is offline
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 06-07-2012, 05:14 PM Re: Please sir, can I have LESS ?
orionoreo's Avatar
Ultra Talker

Posts: 345
Name: Jerry
Trades: 0
so LESS and SASS are all new frameworks for SCSS

Nullpointer, LESS has both server side and client side option where the server side is the fallback for non js systems.

The core concept of SCSS is not focused on the ability to use PHP in css but rather helping organize and create structure around coding css.. so bringing in coding practices such as using variables, manipulating those variables and etc

so it could be something like this:
Code:
@brown: #978618
@ligher-brown: desaturate(lighten(@brown, 50%), 45%);
where this framework really plays well is large teams developing a single site... other than everybody defining a specific font every time you would do it once, and incase the client change their mind you also don't have to do find and replace

Code:
.font {
	font-family: Arial;
	font-size: 12px;
}


.nav {
	.font;
	color: @brown;
	width: 50%;
}

.footer {
	.font;
	color: @lighter-brown;
}
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
orionoreo is offline
Reply With Quote
View Public Profile
 
Old 06-08-2012, 04:57 PM Re: Please sir, can I have LESS ?
vangogh's Avatar
Post Impressionist

Posts: 11,147
Name: Steven Bradley
Location: Boulder, Colorado
Trades: 0
I haven't used them in production yet, but I've played around with both Less and Sass and like them. I'll likely use it in production on my own sites very soon. I haven't decided yet if I will on client sites. Some of my clients will jump in and make simple edits to their css files and once they do you can't really use a preprocessor on that file any more. However you can still use one initially.

Quote:
Originally Posted by Physicsguy
To me, that's too much of a hassle.
Scott there are tools where you pretty much just save the Less or Sass file and everything is complied. Not a hassle at all. Your compiling your php. The only real difference is for you the compiler is happening on the server instead of on your computer.

It's really not different than what you're doing, except that if you use Less or Sass you can benefit from everything the community is doing. There's also a framework built on top of Sass called Compass to take advantage of existing work.

Quote:
Originally Posted by orionoreo
where this framework really plays well is large teams developing a single site
I think they work well for maintenance. For example changing a color scheme quickly across a site or make a change in the font-size of your body copy and having all the proportions for the site adjust.
__________________
l Search Engine Friendly Web Design |
Please login or register to view this content. Registration is FREE

l Design, Development, Marketing, and SEO Tutorials |
Please login or register to view this content. Registration is FREE

l
Please login or register to view this content. Registration is FREE
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Reply     « Reply to Please sir, can I have LESS ?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.28361 seconds with 11 queries