6085 comments
2357 subscribers
6224 on Twitter
Subscribe! Feed reader E-mail

CSS theming, magnification, and foot pedals

I’m working on the stylesheets for a site, which means lots of fiddly little changes.

I decided to make all of my styling changes to my Sass source files instead of editing the attributes in Google Chrome because I found myself forgetting to copy attribute values back from Chrome. Editing the source files directly meant that the changes would be persistent – a slightly slower workflow, but a more reliable one.

I used Chrome to set selected divs to show up with display: block. This meant that I didn’t have to keep triggering hover behaviours myself. Then I used CSS Reloader to reload the stylesheet. Chrome kept my manual attribute changes, like display: block, while applying the new styles. Awesome!

I wanted a quick way to update my browser windows after I saved the file. Saving would automatically trigger Compass’ conversion of the Sass files into CSS, but the browser still used the old stylesheet until I trigged CSS Reloader with F9 or the context menu. I didn’t want to refresh the entire page because that would lose the display: block I’d manually set.

AutoHotkey to the rescue! I wrote a function that saved the current file, waited for Compass to convert the Sass file into CSS, and then used the CSS Reloader shortcut key on all open Chrome windows. This meant that I could have a translucent browser window superimposed on the design PDF for easy comparison (thanks, WinWarden), and an opaque browser window for inspection and navigation.

RefreshStylesheets() {
  Send, ^x^s
  Sleep, 2000
  SetTitleMatchMode, 2
  WinGet, id, list, Chrome
  current := WinExist("A")
  Loop, %id%
  {
    StringTrimRight, this_id, id%a_index%, 0
    WinActivate, ahk_id %this_id%
    WinWaitActive, ahk_id %this_id%,,2
    Send {F9}
  }
  WinActivate, ahk_id %current%
}

Then I mapped it to my foot pedal, just because I could. I didn’t need to take advantage of the 3-way switch, so I mapped all 6 possible functions to RefreshStylesheets.

+F1::RefreshStylesheets()
+F2::RefreshStylesheets()
+F3::RefreshStylesheets()
+F4::Send, +F1
+F5::Send, +F2
+F6::Send, +F3

To make it even easier to fine-tune tiny differences, I installed Magnifixer. I used the “Fixed” mode to magnify the translucent portion I was working on, and I moved the display next to my code. That meant that I could avoid turning my head all the time. I could simply tweak my code, nudge the pedal with my toes, glance at the display (or use peripheral vision!), get it right, and then check the overall view.

Foot pedals are fun. More fun than mapping the shortcut to something like F9 or F12, which would involve taking my fingers off home row and finding a small key. You can literally stamp out bugs.

All this put me in such a good humour that I ended up getting the homepage almost pixel-matched to the specs, except for the limitations on letter-spacing and the adjustments I made for the inconsistencies in the spec layout.

Whee! I can’t wait to use this idea when developing backend code. I’ve played around with Autotest on a Rails project, and it should be a simple matter to write a shell script running selected tests on any project. Fun!

Foot pedal + second monitor = awesome squared.

Short URL: http://sachachua.com/blog/p/23097

On This Day...

  • 2013: Web app idea: Stamp mix calculator — I’ve resolved to send more paper letters. I also have an odd mix of stamps that I want to use [...]
  • 2013: Sketching twelve business ideas — In Running Lean, Ash Maurya recommends that you document your “Plan A”s – sketch out many possible businesses and business [...]
  • 2011: Momentum and holidays — Monday: I don’t do “relaxing holidays” very well. My idea of a perfect holiday is one where I’m all wrung [...]
  • 2010: Thinking out loud: Mapping what I know — I want to map what I know. I want to make what I know more findable. The reverse-chronological order of blog [...]
  • 2009: There are no words to describe the geeky awesomeness of this — Update: Turns out the guy was lipsynching Moosebutter, but it’s still awesome! (found it on Jeff Waugh‘s blog while reading his [...]
  • 2009: Annual letter: the numbers — I sent out 205 hand-personalized yearly updates in my initial set of holiday greetings. I’ve received 60 replies so far, [...]
  • 2009: Ideas for improving my website — Add a section about my speaking topics and events Switch to Drupal and customize it Restore the Feedburner widget that shows how [...]
  • 2009: Ideas for becoming a better networker — Load contact information onto my iPod Touch in a way that I can easily search Explore using a system like SugarCRM Add [...]
  • 2006: Indexing pictures — Adphoto is an advertising photography and digital imaging company. My parents established it 33 years ago. It’s Good Stuff. We’d like to develop [...]
  • 2005: Excellent newbie guide for Planner — Clair Ching has posted a wonderful guide to Planner, complete with screenshots. Check out the following links: - http://eclair.bizhat.com/emacs/plannernewbie.html - http://eclair.bizhat.com/emacs/plannerscreen1.html - http://eclair.bizhat.com/emacs/plannerscreen2.html On Technorati: [...]
  • 2005: Mandrake translations — Thanks to pusakat for telling me about the Mandrake Linux Tagalog Translation Team. Amazing stuff. http://www.mandrakelinux.com/l10n/tl.php3 On Technorati: opensource, tagalog, filipino, localization
  • 2005: So far: contrast with strangeness — GK Chesterton seems a little too weirded out by the East. I suppose ‘Orientals’ really were strange and unfamiliar, almost alien, [...]

Get the highlights as a PDF!

Stories from my Twenties: Highlights from a Decade of Blogging