Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
233 lines (132 sloc) 9.21 KB
<!doctype html>
<!--[if lt IE 9]> <html class="no-js oldie" lang="en"> <![endif]-->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Foldable CSS blocks in SASS with Textmate | Divya Manian</title>
<meta name="author" content="Divya Manian">
<meta name="description" content="I recently started using SASS for my CSS development (thanks to Deepak). SASS is a meta-language that makes developing CSS really easy - provided you &hellip;">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="canonical" href="">
<link href="/stylesheets/screen.css" rel="stylesheet">
<link href="" rel="alternate" title="Subscribe" type="application/atom+xml">
<link href="" rel="alternate" title="Subscribe to Web Development updates" type="application/atom+xml">
<body >
<div class="container">
<div class="content">
<header role="banner"> <h1><a href="/">Divya Manian</a></h1>
<h2><a class="twitter" href="">twitter</a> <a class="rss" href="">RSS Feed</a> <a class="youtube" href="">Youtube Channel</a> <a class="github" href="">Github</a></h2>
<nav class="sitenav"><a href="/">Home</a>
<a href="/archives">Archives</a>
<a href="/about.html">About</a>
<nav class="article">
<a class="previous" href="/analysing-my-information-consumption.html" title="Analysing my Information Consumption">❬</a>
<a class="next" href="/book-reviews-for-june-2009.html" title="Book Reviews for June 2009">❭</a>
<time datetime="2009-06-12T00:00:00-07:00" pubdate><span class='month'>Jun</span> <span class='day'>12</span> <span class='year'>2009</span></time>
<h1 class="entry-title"><a href="/foldable-css-blocks-in-sass-with-textmate.html">Foldable CSS blocks in SASS with Textmate</a></h1>
<div class="entry-content"><p>I recently started using <a href="">SASS</a> for my CSS development (thanks to <a href="">Deepak</a>). SASS is a meta-language that makes developing CSS really easy - provided you master the syntax. There is a very good <a href="">textmate bundle</a> which makes it really simple to use on a mac. I will write more about how it has proven useful, but this post is to resolve a problem of developing CSS with SASS.</p>
<p>SASS identifies child selectors using indentation. For example:</p>
:font-weight bold
:font-weight normal
<p>would translate into CSS as:</p>
#parent { font-weight:bold; }
#parent #child { font-weight:normal;}
<p>When I have about 10 child (or sub-child) elements within each parent, tracking down the parent can become tricky. This is where folding CSS groups come in handy:</p>
<p><img src="/blog/files/sass-folded.png" alt="Folded CSS Group in action" /></p>
<h3>How did I do it?</h3>
<p>First, I found this post on creating <a href="">foldable CSS groups in textmate</a></p>
<p>Here are the steps:</p>
<li>Go to Bundles>Bundle Editor>Edit Languages.</li>
<li>Select the SASS > SASS file on the left column.</li>
<li>Now you should see the language grammar file for SASS, starting with the line &ldquo;{ scopeName = &#8220;source.css&#8221;&rdquo;
find the line &ldquo;foldingStartMarker = &#8221; (line 4)</li>
<li>Edit it to:<br/>
foldingStartMarker = '// START |^#|^\*|^\b|^\.';
<li>Edit the foldingEndMarker to:<br/>
foldingStopMarker = '// END |^#|^\*|^\b|^\.';
<p>Tada! Your folding groups are ready! But it is not easy to type in &ldquo;// START&rdquo; and &ldquo;// END&rdquo; every time. So, you can create a snippet to automate it for you:</p>
<li>Go to Bundles>Bundle Editor>Edit Snippets&#8230;</li>
<li>Select SASS in the left column and click on the &ldquo;+&rdquo; icon at the bottom of the left column. Name it as you like. </li>
<li>Put this snippet on the right column with the snippet name, you created in the previous step, selected.<br/>
// START ${1:name}
// END ${1:name}
<li>Finally, assign a shortcut (Activation Trigger) that you can type and press tab so that you get access to the above (I used the characters &ldquo;fld&rdquo;).</li>
<p>I have created an issue to add this to the sass-textmate-bundle on Github. <a href="">Please vote for it, if you would like to see this feature in the bundle.</a></p>
<p>Thanks to <a href="">Chris Eppstein</a> for nudging me to blog about it!</p>
<p class="meta">This post was posted by
<a href="/about.html">Divya Manian</a>
<time datetime="2009-06-12T00:00:00-07:00" pubdate><span class='month'>Jun</span> <span class='day'>12</span> <span class='year'>2009</span></time> in
<span class="categories">
<a class='category' href='/categories/web-development/'>Web Development</a>
. If you would like to update this post, <a href="">please send a pull request</a>.
<div id="disqus_thread" aria-live="polite"><noscript>Please enable JavaScript to view the <a href="">comments powered by Disqus.</a></noscript>
<aside id="articles">
<p><img class="avatar" src="/assets/divya.png" height=50> <a href="">Divya Manian</a> is a Web Developer in Seattle. <a href="/about.html">More about me ❭</a></p>
<h2>Posts on Web Development</h2>
<ul><li><a href="/html5please.html">html5please</a></li><li><a href="/mustache.html">mustache, hogan, handlebars</a></li><li><a href="/redesign-notes.html">Redesign Notes</a></li><li><a href="/summary-of-various-exciting-css-drafts-and-proposals.html">Summary of various exciting CSS drafts and proposals</a></li><li><a href="/this-revolution-needs-new-revolutionaries.html">This revolution needs new revolutionaries</a></li><li><a href="/some-css-transition-hacks.html">Some CSS Transition hacks</a></li><li><a href="/safe-css-defaults.html">Safe CSS Defaults</a></li><li><a href="/unplugged-2011.html">Unplugged 2011</a></li><li><a href="/bokeh-with-css3-gradients.html">Bokeh with CSS3 Gradients</a></li><li><a href="/making-pure-css3-demos-better.html">Making "Pure CSS3" demos better</a></li><li><a href="/web-opener-at-opera.html">Web Opener at Opera</a></li><li><a href="/current-color-in-css.html">Current Color in CSS</a></li><li><a href="/css-vocabulary.html">CSS Vocabulary</a></li><li><a href="/active-web-development.html">Active Web Development</a></li><li><a href="/sexy-css3-buttons.html">Sexy CSS3 Buttons</a></li><li><a href="/accessible-css-barcharts.html">Accessible CSS Barcharts</a></li><li><a href="/svg-is-coming.html">SVG is coming!</a></li><li><a href="/wee-marquee.html">Wee! Marquee</a></li><li><a href="/vignettes-with-css3-box-shadows.html">Vignettes with CSS3 Box Shadows</a></li><li><a href="/drop-shadows-with-css3.html">Drop Shadows with CSS3</a></li><li><a class="btn" href="/categories/web-development/">More</a></li></ul>
<footer role="contentinfo"><p>
Copy to your heart’s content 2012 - Divya Manian -
<span class="credit">Powered by <a href="">Octopress</a></span>
<script type="text/javascript">
var disqus_shortname = 'nimbublog';
var disqus_developer = 1;
var disqus_url = '';
var disqus_identifier = '';
(function () {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://' + disqus_shortname + '';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
<script src="/javascripts/octopress.js"></script>
var _gaq=[['_setAccount','UA-97188-1'],['_trackPageview']];
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];