Syncing Stylish userstyles with Dropbox

I’ve used Firefox’s Stylish plugin for years to get rid of stuff that I don’t want to see on all kinds of web sites.  Once you know how CSS works, the plugin makes it easy to tweak the look of any page by adding a quick {width:100%;} or {display:none;} to your own personalized CSS userstyle for each site.

The one gripe I’ve had with Stylish is that it doesn’t automatically let you sync your styles across computers.  I’d make a change to a site’s style on my work computer, then get frustrated that I had to make the same change on my home machine.  I keep hoping that Firefox Sync (formerly Weave) will add support for syncing the file where Stylish stores its content (a sqlite file called, creatively enough, stylish.sqlite), but it hasn’t happened yet.

But then I came up with the idea of userstyle syncing via Dropbox — it’s a great service and I already had the client installed on all of the computers that I wanted to sync, so I just had to figure out how to do it.  This blog entry by Rob Wilkerson talked about how to sync all of your Firefox preferences and bookmarks; I already had that part covered with Firefox Sync, but it was the inspiration for me to get off my butt and make my Stylish dreams come true.

At first I thought I’d have to copy my sqlite file into the Dropbox, then make symlinks in my Firefox folder to that file, like Rob did.  They’re called Junctions in Windows parlance, and they’re a little more tricky to work with than symlinks in *nix.  (But they are natively supported in Windows Vista and up, which two out of the three machines I’d be syncing were running.  I’d have to download a special program to get it working in XP on my old laptop.)

But when I poked around a bit in about:config, I found this option: extensions.stylish.dbFile.  It was set to the full file path of the stylish.sqlite file in my Firefox profile directory.

I tried copying the file into my Dropbox, then setting the value of the dbFile option to that file path instead.  (“C:\Users\Curtis\Documents\My Dropbox\stylish.sqlite” in my case.)  When I restarted Firefox, my styles were working right, and I was able to make a change in a userstyle and see Dropbox re-upload it to the cloud.

So then I just had to go into about:config on all of the other client machines and change the extensions.stylish.dbFile option to the path of the Dropbox stylish.sqlite file on that machine.  It works perfectly! I can add a bit of CSS to Stylish on any one of the computers and it is automatically reflected in the other copies of Firefox on the other computers.

This is a brute-force method: you don’t have the option of automatically merging the styles from the various client computers into the unified stylish.sqlite like you would with Firefox Sync, but my userstyles were pretty close across the computers anyway, so it wasn’t a big deal.  Hooray for Firefox, for Stylish, and for Dropbox!  Great software all around, and like peanut butter and chocolate, they go even better together!

This entry was posted on Tuesday, August 24th, 2010 at 7:55 am and is filed under Programming. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

5 Responses to “Syncing Stylish userstyles with Dropbox”

  1. Different tab colors for different contexts - The World of Curtis Gibby - My Blog Says:

    […] do my bidding.  Or syncing not only my bookmarks and passwords between computers, but also my Stylish userstyles.)  Google Chrome may be zippier, but until I can run AdBlock Plus, All-in-One Gestures, […]

  2. TerennNo Gravatar Says:

    That’s cool. Thanks.

  3. Firefox PersonNo Gravatar Says:

    Thanks. This was really helpful, still 5 years later

  4. Geoff MNo Gravatar Says:

    Thanks, I have the exact same problem and was just considering symlinking my stylish folders. Your solutions is more simple. Hopefully stylish will be natively syncable soon.

  5. Geoff MNo Gravatar Says:

    Even better, just discovered the Stylish Sync add-on. Perfect!

Leave a Reply