RSS: Articles| Comments| Trackbacks
 

Syntactically Awesome StyleSheets 2

Posted by haakon, Mon, 25 Jun 2007 23:53:00 GMT

Have you heard of them? In their own words, Sass is:

a meta-language on top of CSS that‘s used to describe the style of a document cleanly and structurally, with more power than flat CSS allows. Sass both provides a simpler, more elegant syntax for CSS and implements various features that are useful for creating manageable stylesheets.

It has cool features like:

  • Better formatting for complexly nested selectors
  • Math support (use simple mathematical expressions)
  • Constants – define a color in one place and use it throughout your file. Want to change it later? Change it in one place only!

To learn more, check out the Sass Documentation. Sounds nifty, eh? I just came across Sass last week and have since change my css files over and it is a definite improvement. Less typing, more readable, better in every way. The only downside is that my editor didn’t give me nice color syntax highlighting for my .sass files.

I’ve just started using the NetBeans 6 editor which has some very nice ruby support. Here is a movie showing off some of it’s features. Unfortunately, it currently does not have support for sass files. So, I took a little bit of time and created a NetBeans module to provide syntax highlighting for Sass files. The beauty of syntax highlighting is that in many ways it works like a compiler, letting you know of errors in your code earlier rather than later. While working with Sass I found it a little annoying to make a mistake in my Sass file and not see the problem until I actually refreshed the page in a browser. Color highlighting can make your mistakes more obvious and findable. For example, when I was converting my css files to sass files, I would often make an error like follows:

a
  :font-size: 10px

I would put the colon to the front of the property name, but forget to remove the colon at the end. Color highlighting can highlight that as you are working on the file making it easier to catch errors. At the moment this is very much in a beta state, but please feel welcome to download and install the module. Currently it only supports sass property names with the colon at the front, rather than at the end.

[Update]

I’ve since found a more recent plugin that someone else is doing a fine job of maintaining. Download the plugin by Dylan Bruzenak

Enjoy!

~haakon

Fixed Impressions

Posted by haakon, Fri, 15 Jun 2007 18:18:00 GMT

For Father’s Day (and Christmas, Birthday, etc.), my lovely wife gave me a new bike. What is better than getting a new bike? Delightful in itself, but to make it more interesting, how about a new bike in a very old style? A growing community of people are riding single speed bikes, and an even smaller segment, fixed gear bikes. I’ve been interested in these bikes, and have now made the plunge. I am currently commuting to work on a Bianchi San Jose fixie.

2007 bianchi san jose fixie

What would possess me to lose 18 gears and only ride with one? Some will say that a fixed gear is very efficient. In some respects it is: a perfectly straight chainline, no shifters, no chainrings, no cassette, A fixed gear bike will be lighter than its counterpart, and the drive train will be more efficient. Also, maintenance is drastically less when you remove all these components from a bicycle. Finally, the unquantifiable feeling you get from riding such a bike is addictive. Somehow I feel like I am riding the quintissential bike when I am riding my fixie. Nothing to think about but pedalling. Total quiet. Everybody should be riding this way!

No! The obivous “but” is that you will not be as efficient if there are any hills where you ride. Though a single speed bike is very efficient on the flats, as soon as hills are introduced all bets are off. Some people ride single speeds as training practice. This is because a single gear forces you to go faster up hills (if you can). Your option is to become a stronger cyclist, or die! (Okay, death may not necessarily ensue).

Also the first time you ride a fixie is freaky! Hop on and it is a little bit tricky to get your feet in the pedals as you cannot pause during your spin to get your foot in. But then it all feels nice and smooth. Really smooth. The bike is quiet, chain is silent, nothing to think about but pedalling. The joy of cycling is there. You are sitting on a machine that magically makes you able to travel miles in 4 minutes rather than 20. Sheer poetry. Oh wait, red light up ahead, I must stop. Begin braking and coasting. WAH! The pedals won’t stop! I almost fell off! Rear wheel seems to be skidding a bit! Oh yeah, the pedals never stop while the bike is moving. Ok, don’t panic, slow down bit by bit. Phew, disaster averted. And don’t get me started on the first time you go down a steep hill. Suddenly what has previously been a delight has been transformed into a terror.

But it gets better! After two weeks I am feeling good. Stops are not a problem, mild downhills are doable, I cruise up most hills faster than I ever would have before. Steep downhills are still not the joy they used to be, but neither do they raise my heart rate. I figure the real test will occur when I try riding a “normal” bike again. Will I want to go back? Who can say.

~haakon