Since this site is getting larger and it’s running on Octopress, the rake generate and rake preview processes are getting slower. Enter rake isolate["x"] to isolate the site down to the selected post. But isolating requires me to note the file name down, there is too much to remember and type and I am lazy.
So have created two macros and a script to speed this process up.
Note: You must run these commands in the root of the Octopress folder, else they will not work at all!
Post
The old, standard way
To create a post in Octopress, isolate it and preview it in the browser, you need to run the following steps:
Create the Post:
1
| |
Isolate the post using the generated file name:
1
| |
And generate and start the preview thread:
1 2 | |
Note that I have already hacked the new_post function in my Rakefile to also log this to Day One and launch Byword, see my post on Bread Crumbs in Day One, so those steps are not shown.
The new way
For this post, I typed in:
1
| |
Note that there is no punctuation after the post command, less for me to type. The script concatenates all parameters into a single title string. The result of the command shows that it does all the steps I did manually, including figuring out the file name, and leaving me in a preview thread:
1 2 3 4 5 6 7 8 | |
Publish
The old, standard way
I would use ^C to stop the preview thread, then:
1 2 | |
The new way
Now I just use ^C to stop the preview thread, and:
1
| |
The macros and scripts
I created the following ruby script to handle the post function. If you want the “Open in Byword” function, uncomment Line 29: open "#{path}" -a Byword (Untested)
I then added the following two macros to my .bash_profile (OS X users only). Note that I keep all my custom scripts in ~/Scripts/:
1 2 3 4 5 6 7 8 | |
These work for all my Octopress sites. It allows me to get to the post faster, preview that it looks right and publish the site with ease.