diff --git a/bin/jekyll b/bin/jekyll index f5d82931..a32e8112 100755 --- a/bin/jekyll +++ b/bin/jekyll @@ -38,6 +38,7 @@ command :new do |c| c.description = 'Creates a new Jekyll site scaffold in PATH' c.option '--force', 'Force creation even if PATH already exists' + c.option '--blank', 'Creates scaffolding but with empty files' c.action do |args, options| Jekyll::Commands::New.process(args, options.__hash__) diff --git a/lib/jekyll/commands/new.rb b/lib/jekyll/commands/new.rb index c1aa3eef..7a2cefcc 100644 --- a/lib/jekyll/commands/new.rb +++ b/lib/jekyll/commands/new.rb @@ -18,6 +18,12 @@ module Jekyll File.open(File.expand_path(self.initialized_post_name, new_blog_path), "w") do |f| f.write(self.scaffold_post_content(site_template)) end + + if options[:blank] + files_to_clear = Dir.glob("#{new_blog_path}/**/*.*") + files_to_clear.each {|file| File.truncate("#{file}", 0)} + end + puts "New jekyll site installed in #{new_blog_path}." end