Skip to content

Instantly share code, notes, and snippets.

@justinspradlin
Last active December 11, 2015 01:38
Show Gist options
  • Save justinspradlin/4524533 to your computer and use it in GitHub Desktop.
Save justinspradlin/4524533 to your computer and use it in GitHub Desktop.
This script will setup DropBox syncing of your Chrome custom stylesheets. This is really useful if you have a custom dev tools stylesheet. More information for custom Dev Tool stylesheets can be found here: http://darcyclarke.me/design/skin-your-chrome-inspector/.
@echo off
:: This script will setup dropbox to sync Chrome's User Stylesheets.
:: It is a shim since Chromium probably won't add this file to Chrome-Sync in the future.
:: See http://code.google.com/p/chromium/issues/detail?id=136479 for more details.
::
:: The main purpose of this script is to sync the style sheet used for Dev Tools.
:: See http://darcyclarke.me/design/skin-your-chrome-inspector/ for more information
:: on stylying your Chrome Dev Tools.
::
:: NOTE: This script must be run as an elevated user since it creates sym-links
::
:: Feel free to use or modify in any way you see fit.
:: Contact me via Twitter - @justintspradlin
:: Enjoy...
:: Settings - Update if needed
SET chromeUserDataDir=%USERPROFILE%\AppData\Local\Google\Chrome\User Data\Default\
SET dropBoxUserDataDir=%USERPROFILE%\Dropbox\Apps\Chrome\User Data\Default\
SET ORIG_DIR=%CD%
:: End Settings
:: Let the user know the current directories
echo Local Chrome User Data dir: %chromeUserDataDir%
echo Dropbox User Data dir: %dropBoxUserDataDir%
:: Parse the command line args
IF "%1"=="" GOTO Usage
IF "%1"=="-i" GOTO InitialSetup
IF "%1"=="-s" GOTO SecondarySetup
:: All other cases go to usage statement
GOTO Usage
:Usage
echo.
echo -i Initial computer setup; This will move the Chrome custom sylesheets directory
echo to your Dropbox directory and create the proper sym-links
echo.
echo -s Secondary computer setup; This will remove your local custom stylesheets and
echo add a sym-link to your dropbox folder
GOTO :EOF
:InitialSetup
echo Making the dropbox stylesheet dir %dropBoxUserDataDir%
mkdir "%dropBoxUserDataDir%"
echo Moving the existing local files to your new drop box folder %dropBoxUserDataDir%
move "%chromeUserDataDir%User StyleSheets" "%dropBoxUserDataDir%"
GOTO CreateSymlinks
:SecondarySetup
echo Creating the Sublime setting folder
:: We need to delete the local contents if they already exist.
:: We will replace these with a symlink to Dropbox.
echo Removing the local files at "%chromeUserDataDir%User StyleSheets"
RD /S "%chromeUserDataDir%User StyleSheets"
:: Create the symlinks
GOTO CreateSymlinks
:CreateSymlinks
echo Changing directory to %chromeUserDataDir% to build symlinks
cd "%chromeUserDataDir%"
echo Creating Symlinks for Sublime Text 2 syncing
mklink /D "User StyleSheets" "%dropBoxUserDataDir%User StyleSheets"
GOTO End
:End
:: Changing back to original directory
cd %ORIG_DIR%
echo Done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment