rake的tips

參考至Some Octopress Rake Tips

剛開始用Octopress的時候感覺上速度還蠻快的,但是在將WP的文章匯入的時候就發現到,每一次的generate就會發現到速度會少許的減慢,好像每一次都會對所有的文章做一次的編譯,造成每次要preview時速度都非常慢,其實裏面有幾個有用的指令可以提昇速度。

1
rake isolate[file_name]

這樣他就會把你要編輯的檔案給獨立出來,將其他的檔案先暫時的放到_stash中,這樣只要下

1
rake preview

此時在localhost:4000就可以預覽,而且速度會提昇不少。編輯完後只要另外下

1
rake integrate

即可將原先遷移的檔案搬回來,要generate順便deploy

1
rake gen_deploy

而要查看rake所有可用的指令,就下

1
rake -T

就會跑出

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
rake clean                     # Clean out caches: .pygments-cache, .gist-cache, .sass-cache
rake copydot[source,dest]      # copy dot files for deployment
rake deploy                    # Default deploy task
rake gen_deploy                # Generate website and deploy
rake generate                  # Generate jekyll site
rake install[theme]            # Initial setup for Octopress: copies the default theme into the path of Jekyll's generator.
rake integrate                 # Move all stashed posts back into the posts directory, ready for site generation.
rake isolate[filename]         # Move all other posts than the one currently being worked on to a temporary stash location (stash) so regenerating the site happens much quicker.
rake list                      # list tasks
rake new_page[filename]        # Create a new page in source/(filename)/index.markdown
rake new_post[title]           # Begin a new post in source/_posts
rake preview                   # preview the site in a web browser
rake push                      # deploy public directory to github pages
rake rsync                     # Deploy website via rsync
rake set_root_dir[dir]         # Update configurations to support publishing to root or sub directory
rake setup_github_pages[repo]  # Set up _deploy folder and deploy branch for Github Pages deployment
rake update_source[theme]      # Move source to source.old, install source theme updates, replace source/_includes/navigation.html with source.old's navigation
rake update_style[theme]       # Move sass to sass.old, install sass theme updates, replace sass/custom with sass.old/custom
rake watch                     # Watch the site and regenerate when it changes
Sat Sep. 8 2012
Comments

Comments