<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

    <channel>
    
    <title><![CDATA[Blog]]></title>
    <link>http://artminister.com/</link>
    <description />
    <dc:language>en</dc:language>
    <dc:creator>rmdort@gmail.com</dc:creator>
    <dc:rights>Copyright 2011</dc:rights>
    <dc:date>2011-11-27T04:49:50+00:00</dc:date>
    <admin:generatorAgent rdf:resource="http://expressionengine.com/" />
    

    <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/artminister" /><feedburner:info uri="artminister" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:browserFriendly></feedburner:browserFriendly><item>
      <title><![CDATA[Preventing Spam Members and Links in Expression Engine]]></title>
      <link>http://artminister.com/site/preventing-spam-members-and-links-in-expression-engine</link>
      <guid>http://artminister.com/site/preventing-spam-members-and-links-in-expression-engine#When:04:49:50Z</guid>
      <description><![CDATA[<p>One thing EE developer forget is that, membership is always set to &#8220;ON&#8221; in the configuration. Even the membership triggering word is set to &#8220;member&#8221;. This can lead to a lot of spam member registrations, and these members post links in their signatures. In EE, member profiles are public by default. So when you google for your site, these spam links appear in the results as well.</p><p>I came across this issue when i was checking AWstats for my website and i saw a lot of spam links in the search keywords. This <a href="http://www.warriorforum.com/adsense-ppc-seo-discussion-forum/360342-real-tip-finding-forum-profiles.html">website</a> illustrates how spammer use inurl method to scan for EE websites

<p><img src="https://img.skitch.com/20111127-pcctijxbtwhmdmky28tafab8wd.jpg" alt=""></p>

<p>Most of the sites we did didnt use membership at all. What i did to fix these spam links is to</p>
<ol>
<li>Turn off membership in the site</li>
<li>Create a random profile triggering word</li>
</ol>
<p><img src="https://img.skitch.com/20111127-xxg5fkfed55w436c192sh8gecg.jpg" alt=""></p>

<p>Hope this helps everyone who are sick of these spammers.</p>
]]></description>
      <dc:subject><![CDATA[Expression Engine,]]></dc:subject>
      <dc:date>2011-11-27T04:49:50+00:00</dc:date>
    </item>

    <item>
      <title><![CDATA[Simple Expression Engine Database Backup]]></title>
      <link>http://artminister.com/site/simple-expression-engine-database-backup</link>
      <guid>http://artminister.com/site/simple-expression-engine-database-backup#When:11:28:48Z</guid>
      <description><![CDATA[<p>A simple Expression Engine database backup solution using php in templates and Codeigniter database Utilities.</p><p>All you have to do is create a EE template and enable php. Add the following code and viola, visit the url in your browser and download the full database backup.</p>

<div class="codeblock"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br />$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">EE&nbsp;</span><span style="color: #007700">=&amp;&nbsp;</span><span style="color: #0000BB">get_instance</span><span style="color: #007700">();<br /></span><span style="color: #FF8000">//&nbsp;Load&nbsp;the&nbsp;DB&nbsp;utility&nbsp;class<br /></span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">EE</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">load</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">dbutil</span><span style="color: #007700">();<br /><br /></span><span style="color: #FF8000">//&nbsp;Backup&nbsp;your&nbsp;entire&nbsp;database&nbsp;and&nbsp;assign&nbsp;it&nbsp;to&nbsp;a&nbsp;variable<br /></span><span style="color: #0000BB">$backup&nbsp;</span><span style="color: #007700">=&amp;&nbsp;</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">EE</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">dbutil</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">backup</span><span style="color: #007700">();<br /><br /></span><span style="color: #FF8000">//&nbsp;Load&nbsp;the&nbsp;file&nbsp;helper&nbsp;and&nbsp;write&nbsp;the&nbsp;file&nbsp;to&nbsp;your&nbsp;server<br /></span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">EE</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">load</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">helper</span><span style="color: #007700">(</span><span style="color: #DD0000">'file'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">write_file</span><span style="color: #007700">(</span><span style="color: #DD0000">'SERVER_PATH/mybackup.gz'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$backup</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;Load&nbsp;the&nbsp;download&nbsp;helper&nbsp;and&nbsp;send&nbsp;the&nbsp;file&nbsp;to&nbsp;your&nbsp;desktop<br /></span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">EE</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">load</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">helper</span><span style="color: #007700">(</span><span style="color: #DD0000">'download'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">force_download</span><span style="color: #007700">(</span><span style="color: #DD0000">'mybackup.gz'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$backup</span><span style="color: #007700">);&nbsp;<br /><br /></span><span style="color: #0000BB">?&gt;&nbsp;</span>
</span>
</code></div>

<p>You can customize the filename, tables etc. Follow this guide : <a href="http://codeigniter.com/user_guide/database/utilities.html#backup">http://codeigniter.com/user_guide/database/utilities.html#backup</a></p>

<p>Do remember to password protect the template to prevent unauthorized access.</p>

<p>Good luck</p>]]></description>
      <dc:subject><![CDATA[Expression Engine,]]></dc:subject>
      <dc:date>2011-07-01T11:28:48+00:00</dc:date>
    </item>

    <item>
      <title><![CDATA[Canon Ixus Style featured on Show-ee]]></title>
      <link>http://artminister.com/site/canon-ixus-style-featured-on-show-ee</link>
      <guid>http://artminister.com/site/canon-ixus-style-featured-on-show-ee#When:08:13:24Z</guid>
      <description><![CDATA[<p>We are proud to have <a href="http://www.canon.com.sg/styleixus/">Canon Ixus Style</a>, an EE2  built by us featured on <a href="http://show-ee.com">Show-ee</a>.&nbsp; You can read the details  <a href="http://show-ee.com/spotlight/details/canon_ixus/">here</a>.</p>

<p>The site was designed by my good friend Preston Tan from <a href="http://juxido.com">Juxido.com</a>. Props to him for designing such a clean and elegant site.</p>]]></description>
      <dc:subject><![CDATA[Expression Engine, Web Design,]]></dc:subject>
      <dc:date>2011-06-01T08:13:24+00:00</dc:date>
    </item>

    <item>
      <title><![CDATA[Working with Git and SVN Repository]]></title>
      <link>http://artminister.com/site/working-with-git-and-svn-repository</link>
      <guid>http://artminister.com/site/working-with-git-and-svn-repository#When:05:58:36Z</guid>
      <description><![CDATA[<p>Lately I have been working on some projects where the files are hosted in svn repository, and since git has built in support for svn, it was a breeze to set it up. Clients use <a href="http://versionsapp.com">Versions</a> to commit/log the changes and <a href="http://unfuddle.com">UnFuddle</a> is where all the svn source files are hosted.</p><p>Some of the git commands are different when working with svn. The basic changes are</p>

<div class="codeblock"><code><span style="color: #000000">
<span style="color: #0000BB">git&nbsp;</span><span style="color: #007700">clone&nbsp;&nbsp;=&gt;&nbsp;</span><span style="color: #0000BB">git&nbsp;svn&nbsp;</span><span style="color: #007700">clone&nbsp;-</span><span style="color: #0000BB">s<br /><br />git&nbsp;pull&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">git&nbsp;svn&nbsp;rebase<br /><br />git&nbsp;push&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">git&nbsp;svn&nbsp;dcommit&nbsp;</span>
</span>
</code></div>

<h3>Cloning the svn repo using Git</h3>

<p>The First and foremost step is to Clone the SVN Repository to your local machine using git-svn clone. Given that you have created your repository in Unfuddle.</p>

<div class="codeblock"><code><span style="color: #000000">
<span style="color: #0000BB">git&nbsp;svn&nbsp;</span><span style="color: #007700">clone&nbsp;-</span><span style="color: #0000BB">s&nbsp;http</span><span style="color: #007700">:</span><span style="color: #FF8000">//project.unfuddle.com/svn/project_repo/&nbsp;</span>
</span>
</code></div>

<p>Git will create a full clone of your svn repository with all the branches, trunks and tags</p>

<h3>Setting up .gitignore</h3>

<p>Set up your gitignore file as normal. I usually have the following in my .gitignore file</p>

<div class="codeblock"><code><span style="color: #000000">
<span style="color: #007700">.</span><span style="color: #0000BB">DS_Store<br /></span><span style="color: #007700">.</span><span style="color: #0000BB">gitignore&nbsp;</span>
</span>
</code></div>

<h3>Create a Branch and Committing</h3>

<p>I usually dont do this, unless i am creating a new feature for the application. Eg: A javascript carousel, or a new user authentication system. You can work as per normal with the files and when ready to commit, use</p>

<div class="codeblock"><code><span style="color: #000000">
<span style="color: #0000BB">git&nbsp;commit&nbsp;</span><span style="color: #007700">-</span><span style="color: #0000BB">a&nbsp;</span><span style="color: #007700">-</span><span style="color: #0000BB">m&nbsp;</span><span style="color: #DD0000">"Modified&nbsp;aa.html&nbsp;and&nbsp;added&nbsp;a&nbsp;smiley&nbsp;face&nbsp;:)"&nbsp;</span>
</span>
</code></div>

<p>Before i push the files to the svn remote repo, i always make sure to update my local files using git svn rebase. I will fix any conflicts that may occur and push the files to remote svn using </p>

<div class="codeblock"><code><span style="color: #000000">
<span style="color: #0000BB">git&nbsp;svn&nbsp;rebase<br />git&nbsp;svn&nbsp;dcommit&nbsp;</span>
</span>
</code></div>

<h3>Git Stash</h3>

<p><a href="http://www.kernel.org/pub/software/scm/git/docs/git-stash.html">Git stash</a> has been my livesaver for all my projects. Lets say you are work on something important(A.html) which is like half complete,&nbsp; and your collegue says &#8220;He there is a bug in one of your files(B.html), can you fix that ?&#8221;.&nbsp; I dont want to commit my A.html changes since it is a uncompleted version. I use git stash here which records the changes in A.html and goes back to clean working directory. Now i make the edits to B.html, commit it and push it the svn repository. When i am done with fixing the bugs, i take back A.html using:</p>

<div class="codeblock"><code><span style="color: #000000">
<span style="color: #0000BB">git&nbsp;stash&nbsp;apply&nbsp;</span>
</span>
</code></div>

<p>It will bring back all the changes i had done to A.html and i am ready to roll. </p>

<h3>Reverting a file</h3>

<p>It works the same way as in git</p>

<div class="codeblock"><code><span style="color: #000000">
<span style="color: #0000BB">git&nbsp;checkout&nbsp;</span><span style="color: #007700">--&nbsp;</span><span style="color: #0000BB">filename&nbsp;</span>
</span>
</code></div>

<p>These are some of the basic commands i use to manage svn repository with git. No complex stuff here.</p>]]></description>
      <dc:subject><![CDATA[Git,]]></dc:subject>
      <dc:date>2011-01-15T05:58:36+00:00</dc:date>
    </item>

    <item>
      <title><![CDATA[Git and Expression Engine]]></title>
      <link>http://artminister.com/site/git-and-expression-engine</link>
      <guid>http://artminister.com/site/git-and-expression-engine#When:06:50:22Z</guid>
      <description><![CDATA[<p>How do you configure Expression Engine to run with the most powerful version control architecture Git.</p><p>I have had experience using both EE 1.6 and EE 2 with git. EE 1.6 was a real headache mainly because of template synchronization. Let me give you a walk-through to using Git and EE2 on Eleven2 servers. </p>

<p>What we are doing is a fully version controlled and command line deployment of EE2.</p>

<p><strong>Add/Edit Files Locally -> Push to Remote Server -> Deploy</strong></p>

<p>Before we begin, lets make the following assumptions.</p>

<ol>
	<li>You have installed git on your local system</li>
	<li>You have a git enabled remote server</li>
</ol>

<h3>Step 1</h3>

<p>The first we do is set up EE2 in our local system and git it. We need to create a .gitignore file as we have to exclude config.php and few other folders from being copied over to production.</p>

<p>My .gitignore file looks like</p>

<div class="codeblock"><code><span style="color: #000000">
<span style="color: #FF8000">//&nbsp;File&nbsp;.gitignore&nbsp;:&nbsp;Make&nbsp;sure&nbsp;its&nbsp;in&nbsp;the&nbsp;project&nbsp;directory<br />&nbsp;&nbsp;&nbsp;&nbsp;<br /></span><span style="color: #007700">.</span><span style="color: #0000BB">DS_Store<br />system</span><span style="color: #007700">/</span><span style="color: #0000BB">cache</span><span style="color: #FF8000">/*<br />system/config.php<br />system/config.local.php<br />images/uploads<br />images/avatars/uploads<br />images/member_photos/<br />images/captchas/*<br />images/*.psd<br />images/contestphotos<br />images/forum_attachments<br />images/country&nbsp;</span>
</span>
</code></div>

<div class="codeblock"><code><span style="color: #000000">
<span style="color: #0000BB">cd&nbsp;</span><span style="color: #007700">/</span><span style="color: #0000BB">wamp</span><span style="color: #007700">/</span><span style="color: #0000BB">htdocs</span><span style="color: #007700">/</span><span style="color: #0000BB">ee2<br />touch&nbsp;</span><span style="color: #007700">.</span><span style="color: #0000BB">gitignore&nbsp;<br /><br /></span><span style="color: #FF8000">//&nbsp;Next&nbsp;copy&nbsp;and&nbsp;paste&nbsp;the&nbsp;content&nbsp;into&nbsp;.gitignore&nbsp;</span>
</span>
</code></div>

<p>Now we are ready for initializing git</p>

<div class="codeblock"><code><span style="color: #000000">
<span style="color: #0000BB">cd&nbsp;</span><span style="color: #007700">/</span><span style="color: #0000BB">wamp</span><span style="color: #007700">/</span><span style="color: #0000BB">htdocs</span><span style="color: #007700">/</span><span style="color: #0000BB">ee2<br />git&nbsp;init<br />git&nbsp;add&nbsp;</span><span style="color: #007700">.<br /></span><span style="color: #0000BB">git&nbsp;commit&nbsp;</span><span style="color: #007700">-</span><span style="color: #0000BB">a&nbsp;</span><span style="color: #007700">-</span><span style="color: #0000BB">m&nbsp;</span><span style="color: #DD0000">"Initial&nbsp;Commit"&nbsp;</span>
</span>
</code></div>

<p>This will gitify your EE2 installation.</p>

<h3>Step 2</h3>

<p>Next you need to set a remote repository in your remote server. This remote repo can either be on your own server or github.com. Its always advisable to set up the remote repo on</p>

<div class="codeblock"><code><span style="color: #000000">
<span style="color: #FF8000">//&nbsp;SSH&nbsp;to&nbsp;Remote&nbsp;server&nbsp;:&nbsp;Username&nbsp;:&nbsp;app<br /></span><span style="color: #0000BB">ssh&nbsp;</span><span style="color: #007700">-</span><span style="color: #0000BB">p&nbsp;1122&nbsp;app</span><span style="color: #007700">@</span><span style="color: #0000BB">server</span><span style="color: #007700">.</span><span style="color: #0000BB">com<br />cd&nbsp;</span><span style="color: #007700">/</span><span style="color: #0000BB">home</span><span style="color: #007700">/</span><span style="color: #0000BB">app</span><span style="color: #007700">/</span><span style="color: #0000BB">git<br />git&nbsp;init&nbsp;</span><span style="color: #007700">--</span><span style="color: #0000BB">bare&nbsp;</span>
</span>
</code></div>

<p>This will create a bare remote repository in the server.</p>

<h3>Step 3</h3>

<p>In your local repo, we need to add the remote server. So navigate to your local directory</p>

<div class="codeblock"><code><span style="color: #000000">
<span style="color: #0000BB">cd&nbsp;</span><span style="color: #007700">/</span><span style="color: #0000BB">wamp</span><span style="color: #007700">/</span><span style="color: #0000BB">htdocs</span><span style="color: #007700">/</span><span style="color: #0000BB">ee2<br />git&nbsp;remote&nbsp;add&nbsp;origin&nbsp;ssh</span><span style="color: #007700">:</span><span style="color: #FF8000">//app@server.com:1122/home/app/git<br /></span><span style="color: #0000BB">git&nbsp;push&nbsp;<br /></span><span style="color: #FF8000">//&nbsp;This&nbsp;will&nbsp;push&nbsp;all&nbsp;the&nbsp;files&nbsp;from&nbsp;local&nbsp;to&nbsp;remote&nbsp;</span>
</span>
</code></div>

<h3>Step 4</h3>

<p>So all our local changes are now migrated to remote repository. And now we need to pull all those files and deploy it in remote server public_html</p>

<div class="codeblock"><code><span style="color: #000000">
<span style="color: #0000BB">ssh&nbsp;</span><span style="color: #007700">-</span><span style="color: #0000BB">p&nbsp;1122&nbsp;app</span><span style="color: #007700">@</span><span style="color: #0000BB">server</span><span style="color: #007700">.</span><span style="color: #0000BB">com<br />cd&nbsp;public_html</span><span style="color: #007700">/<br /></span><span style="color: #0000BB">git&nbsp;</span><span style="color: #007700">clone&nbsp;/</span><span style="color: #0000BB">home</span><span style="color: #007700">/</span><span style="color: #0000BB">app</span><span style="color: #007700">/</span><span style="color: #0000BB">git&nbsp;</span>
</span>
</code></div>

<p>This will create a full fledged repository in the publc_html and will get all the files from the remote repo /home/app/git.</p>

<h3>Final Step: Deployment</h3>

<p>What i do to deploy is </p>

<div class="codeblock"><code><span style="color: #000000">
<span style="color: #FF8000">//&nbsp;Local<br />&nbsp;&nbsp;&nbsp;&nbsp;<br /></span><span style="color: #0000BB">git&nbsp;commit&nbsp;</span><span style="color: #007700">-</span><span style="color: #0000BB">a&nbsp;</span><span style="color: #007700">-</span><span style="color: #0000BB">m&nbsp;</span><span style="color: #DD0000">"Commit&nbsp;message&nbsp;here"<br /></span><span style="color: #0000BB">git&nbsp;push&nbsp;origin&nbsp;master<br />ssh&nbsp;</span><span style="color: #007700">-</span><span style="color: #0000BB">p&nbsp;1122&nbsp;app</span><span style="color: #007700">@</span><span style="color: #0000BB">server</span><span style="color: #007700">.</span><span style="color: #0000BB">com&nbsp;</span><span style="color: #DD0000">"cd&nbsp;public_html;git&nbsp;pull&nbsp;origin&nbsp;master"&nbsp;</span>
</span>
</code></div>

<p>Thats it easy peasy. I dont have to upload any files using ftp. Just 3 lines and my site is synced.</p>

<p>&nbsp;</p>]]></description>
      <dc:subject><![CDATA[Expression Engine, Git,]]></dc:subject>
      <dc:date>2010-12-18T06:50:22+00:00</dc:date>
    </item>

    <item>
      <title><![CDATA[Less css ..My First hand experience]]></title>
      <link>http://artminister.com/site/less-css-my-first-hand-experience</link>
      <guid>http://artminister.com/site/less-css-my-first-hand-experience#When:15:22:52Z</guid>
      <description><![CDATA[<p><a href="http://lesscss.org/">Less CSS</a> is an object oriented approach to CSS development. Just like any programming language, we can use variables, functions and re-usable codes with less.</p><p>I am using the JavaScript version of less called <a href="https://github.com/cloudhead/less.js">less.js</a> which is still under development. The whole idea of using a sass stylesheet came about when my close coding buddy <a href="http://blog.choonkeat.com/weblog/chew-choon-keat.html">Choon Keat</a> started talking so highly about less. It happened that every time we meet, we would talk about it. </p>

<p>So the css of Artminister.com is run by less.js. Frankly speaking i finished the css in less than an hour and it turned out great.</p>

<p>Let me tell how i am using less to drive my css.</p>

<h3>How to run less</h3>

<p>As simple as adding the following code in &lt;head&gt; &lt;/head&gt; of your site</p>

<div class="codeblock"><code><span style="color: #000000">
<span style="color: #007700">&lt;</span><span style="color: #0000BB">link&nbsp;rel</span><span style="color: #007700">=</span><span style="color: #DD0000">"stylesheet/less"&nbsp;</span><span style="color: #0000BB">href</span><span style="color: #007700">=</span><span style="color: #DD0000">"&#123;site_url&#125;css/artminister.less"</span><span style="color: #007700">&gt;&nbsp;<br />&lt;</span><span style="color: #0000BB">script&nbsp;src</span><span style="color: #007700">=</span><span style="color: #DD0000">"&#123;site_url&#125;js/less-1.0.38.min.js"</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">&lt;/script&gt;&nbsp;</span>
</span>
</code></div>

<p>Or if you want to use the gem, have a look <a href="http://lesscss.org/">Less Site</a>.</p>

<p>Do remember to set the rel attribute of the css to &#8220;stylesheet/less&#8221;. Once set the .less file will be parsed using less.js. </p>

<p><b>Update</b><br />
The file extension doesnt have to be .less. Css files will also be parsed by less.js</p>

<h3>Setting Variables</h3>

<p>What i have done is set the common variables such as site width, column spacing, and fonts in the beginning of the css file </p>

<div class="codeblock"><code><span style="color: #000000">
<span style="color: #007700">@</span><span style="color: #0000BB">site</span><span style="color: #007700">-</span><span style="color: #0000BB">width</span><span style="color: #007700">:</span><span style="color: #0000BB">960px</span><span style="color: #007700">;<br />@</span><span style="color: #0000BB">gutter</span><span style="color: #007700">:&nbsp;</span><span style="color: #0000BB">20px</span><span style="color: #007700">;<br />@</span><span style="color: #0000BB">font</span><span style="color: #007700">-</span><span style="color: #0000BB">heading</span><span style="color: #007700">:</span><span style="color: #DD0000">'Vollkorn'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">serif</span><span style="color: #007700">;<br />@</span><span style="color: #0000BB">font</span><span style="color: #007700">-</span><span style="color: #0000BB">nav</span><span style="color: #007700">:</span><span style="color: #DD0000">'Nobile'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">serif</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">#Wrapper&#123;width:@site-width;&nbsp;margin:@gutter/2&nbsp;auto;&#125;&nbsp;</span>
</span>
</code></div>

<p>The above code translates to </p>

<div class="codeblock"><code><span style="color: #000000">
<span style="color: #FF8000">#Wrapper&#123;width:960px;&nbsp;margin:10px&nbsp;auto;&#125;&nbsp;</span>
</span>
</code></div>

<h3>Mixins</h3>

<p>One of the most useful feature of less is mixins. Its a group of code which can be re-used in your css file. So you can edit-once and the changes are reflected all through out.</p>

<div class="codeblock"><code><span style="color: #000000">
<span style="color: #007700">.</span><span style="color: #0000BB">last</span><span style="color: #007700">-</span><span style="color: #0000BB">child&#123;<br />&nbsp;&nbsp;&nbsp;&nbsp;margin</span><span style="color: #007700">-</span><span style="color: #0000BB">bottom</span><span style="color: #007700">:</span><span style="color: #0000BB">0</span><span style="color: #007700">;&nbsp;</span><span style="color: #0000BB">border</span><span style="color: #007700">-</span><span style="color: #0000BB">bottom</span><span style="color: #007700">:</span><span style="color: #0000BB">0</span><span style="color: #007700">;<br />&nbsp;&nbsp;</span><span style="color: #0000BB">&#125;<br />&nbsp;&nbsp;<br />&nbsp;&nbsp;</span><span style="color: #007700">.</span><span style="color: #0000BB">text</span><span style="color: #007700">-</span><span style="color: #0000BB">shadow&#123;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">-</span><span style="color: #0000BB">webkit</span><span style="color: #007700">-</span><span style="color: #0000BB">text</span><span style="color: #007700">-</span><span style="color: #0000BB">shadow</span><span style="color: #007700">:-</span><span style="color: #0000BB">1px&nbsp;</span><span style="color: #007700">-</span><span style="color: #0000BB">1px&nbsp;1px&nbsp;</span><span style="color: #FF8000">#fff;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">text</span><span style="color: #007700">-</span><span style="color: #0000BB">shadow</span><span style="color: #007700">:-</span><span style="color: #0000BB">1px&nbsp;</span><span style="color: #007700">-</span><span style="color: #0000BB">1px&nbsp;1px&nbsp;</span><span style="color: #FF8000">#fff;<br />&nbsp;&nbsp;</span><span style="color: #0000BB">&#125;<br /><br /></span><span style="color: #FF8000">//&nbsp;Textshadow&nbsp;<br /><br /></span><span style="color: #0000BB">nav&nbsp;a&#123;</span><span style="color: #007700">.</span><span style="color: #0000BB">text</span><span style="color: #007700">-</span><span style="color: #0000BB">shadow</span><span style="color: #007700">;</span><span style="color: #0000BB">&#125;&nbsp;</span><span style="color: #FF8000">//&nbsp;This&nbsp;is&nbsp;how&nbsp;you&nbsp;use&nbsp;a&nbsp;mixin&nbsp;</span>
</span>
</code></div>

<p>You can even set variables in mixins using</p>

<div class="codeblock"><code><span style="color: #000000">
<span style="color: #007700">.</span><span style="color: #0000BB">text</span><span style="color: #007700">-</span><span style="color: #0000BB">shadow</span><span style="color: #007700">(@</span><span style="color: #0000BB">size</span><span style="color: #007700">:</span><span style="color: #0000BB">1px</span><span style="color: #007700">,&nbsp;@</span><span style="color: #0000BB">color</span><span style="color: #007700">:</span><span style="color: #FF8000">#fff)&#123;<br />&nbsp;</span><span style="color: #007700">-</span><span style="color: #0000BB">webkit</span><span style="color: #007700">-</span><span style="color: #0000BB">text</span><span style="color: #007700">-</span><span style="color: #0000BB">shadow</span><span style="color: #007700">:-@</span><span style="color: #0000BB">size&nbsp;</span><span style="color: #007700">-@</span><span style="color: #0000BB">size&nbsp;</span><span style="color: #007700">@</span><span style="color: #0000BB">size&nbsp;</span><span style="color: #007700">@</span><span style="color: #0000BB">color</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">text</span><span style="color: #007700">-</span><span style="color: #0000BB">shadow</span><span style="color: #007700">:-@</span><span style="color: #0000BB">size&nbsp;</span><span style="color: #007700">-@</span><span style="color: #0000BB">size&nbsp;</span><span style="color: #007700">@</span><span style="color: #0000BB">size&nbsp;</span><span style="color: #007700">@</span><span style="color: #0000BB">color</span><span style="color: #007700">;<br />&nbsp;&nbsp;</span><span style="color: #0000BB">&#125;<br /><br /></span><span style="color: #FF8000">//&nbsp;Call&nbsp;the&nbsp;above&nbsp;mixin&nbsp;using<br /><br /></span><span style="color: #0000BB">nav&nbsp;a&#123;</span><span style="color: #007700">.</span><span style="color: #0000BB">text</span><span style="color: #007700">-</span><span style="color: #0000BB">shadow</span><span style="color: #007700">(</span><span style="color: #0000BB">5px</span><span style="color: #007700">,</span><span style="color: #FF8000">#fff);&#125;&nbsp;</span>
</span>
</code></div>

<p>Sweet right.</p>

<h3>Write less css</h3>

<p>Nesting is one of the main plus points of less. Take the example below</p>

<div class="codeblock"><code><span style="color: #000000">
<span style="color: #FF8000">//&nbsp;Without&nbsp;less<br /><br /></span><span style="color: #0000BB">nav&#123;text</span><span style="color: #007700">-</span><span style="color: #0000BB">align</span><span style="color: #007700">:</span><span style="color: #0000BB">left</span><span style="color: #007700">;&nbsp;</span><span style="color: #0000BB">margin</span><span style="color: #007700">:</span><span style="color: #0000BB">0&nbsp;20px&nbsp;0</span><span style="color: #007700">;</span><span style="color: #0000BB">&#125;<br />nav&nbsp;ul&nbsp;a&#123;color</span><span style="color: #007700">:</span><span style="color: #FF8000">#444;&#125;<br /></span><span style="color: #0000BB">nav&nbsp;ul&nbsp;a</span><span style="color: #007700">:</span><span style="color: #0000BB">hover&#123;color</span><span style="color: #007700">:</span><span style="color: #FF8000">#111;&#125;<br /><br />//&nbsp;With&nbsp;less<br /><br /></span><span style="color: #0000BB">nav&#123;<br />&nbsp;text</span><span style="color: #007700">-</span><span style="color: #0000BB">align</span><span style="color: #007700">:</span><span style="color: #0000BB">left</span><span style="color: #007700">;&nbsp;</span><span style="color: #0000BB">margin</span><span style="color: #007700">:</span><span style="color: #0000BB">0&nbsp;20px&nbsp;0</span><span style="color: #007700">;<br />&nbsp;</span><span style="color: #0000BB">ul&#123;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a&#123;color</span><span style="color: #007700">:</span><span style="color: #FF8000">#444;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">&amp;:</span><span style="color: #0000BB">hover&#123;color</span><span style="color: #007700">:</span><span style="color: #FF8000">#111;&#125;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#125;<br />&nbsp;&nbsp;&nbsp;&nbsp;&#125;<br />&#125;&nbsp;</span>
</span>
</code></div>

<p>Although there are more lines in the above code, its still simpler. You don&#8217;t have to write parent selectors for every line of css.</p>

<h3>Which one should you use ? Ruby or JS version</h3>

<p>When you have the less ruby gem installed, the .less file is compiled server side. So css is generated even if JavaScript is disabled in the browser. Although according to tests conducted by <a href="http://blog.choonkeat.com/weblog/chew-choon-keat.html">Choon Keat</a>, JS version is much much faster than the gem. </p>

<p>If you ask me, i am going to go with the JS version. I love to see my hand-coded .less css file in browser source. And its much faster too. I dont really worry about js disabled browsers.</p>

<p>Anways this is just my short review of less.js. If there&#8217;s anything you would like to know, post in the comments. I will be happy to answer. </p>

<p>&nbsp;</p>]]></description>
      <dc:subject><![CDATA[css,]]></dc:subject>
      <dc:date>2010-12-17T15:22:52+00:00</dc:date>
    </item>

    
    </channel>
</rss>

