From c2654f29e4de45309767cef17c7bfa5e094d35e4 Mon Sep 17 00:00:00 2001 From: maddentim Date: Mon, 16 Jan 2012 10:16:54 -0800 Subject: [PATCH] Created Development tips and tricks (markdown) --- Development-tips-and-tricks.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Development-tips-and-tricks.md diff --git a/Development-tips-and-tricks.md b/Development-tips-and-tricks.md new file mode 100644 index 0000000..61071ac --- /dev/null +++ b/Development-tips-and-tricks.md @@ -0,0 +1,21 @@ +This page contains a few tips and tricks that may help you with development on tracks. + +## Clearing cached javascript and css files + +Rails bundles the various javascript and css files into cached files to improve performance. When changes are made to javascript or css files, you need to force Rails to recreate them. This little script deletes those cached files and then touches the restart.txt file to causes the server (at least if you are running passenger) to restart itself the next time tracks runs. If you are running linux, place the code below in a file called tracks.clear.sh or whatever you prefer. The following steps in a terminal should set it up for you. You may substitute your editor of choice for nano and set your own path for the script (I use ~/myscripts). + + mkdir /path/to/myscripts + nano /path/to/myscripts/tracks.clear.sh + # paste in the code + chmod u+x tracks.clear.sh + cd ~/bin + ln -s /path/to/myscripts/tracks.clear.sh tracks.clear + +Here is the code for the file itself. Change the /path/to/tracks/ path to the path on your server. + + #!/bin/sh + + rm /path/to/tracks/public/javascripts/jquery-cached.js + rm /path/to/tracks/public/javascripts/tracks-cached.js + rm /path/to/tracks/public/stylesheets/tracks-cached.css + touch /path/to/tracks/tmp/restart.txt