lib/nanoc/cli/commands/create-site.rb in nanoc-3.6.7 vs lib/nanoc/cli/commands/create-site.rb in nanoc-3.6.8
- old
+ new
@@ -1,13 +1,13 @@
# encoding: utf-8
usage 'create-site [options] path'
aliases :create_site, :cs
summary 'create a site'
-description <<-EOS
+description "
Create a new site at the given path. The site will use the `filesystem_unified` data source by default, but this can be changed using the `--datasource` commandline option.
-EOS
+"
required :d, :datasource, 'specify the data source for the new site'
module Nanoc::CLI::Commands
@@ -100,29 +100,26 @@
# * Item identifiers start and end with a slash (e.g. “/about/” for the file
# “content/about.html”). To select all children, grandchildren, … of an
# item, use the pattern “/about/*/”; “/about/*” will also select the parent,
# because “*” matches zero or more characters.
-compile '/stylesheet/' do
- # don’t filter or layout
-end
-
compile '*' do
- if item.binary?
+ if item[:extension] == 'css'
+ # don’t filter stylesheets
+ elsif item.binary?
# don’t filter binary items
else
filter :erb
layout 'default'
end
end
-route '/stylesheet/' do
- '/style.css'
-end
-
route '*' do
- if item.binary?
+ if item[:extension] == 'css'
+ # Write item with identifier /foo/ to /foo.css
+ item.identifier.chop + '.css'
+ elsif item.binary?
# Write item with identifier /foo/ to /foo.ext
item.identifier.chop + '.' + item[:extension]
else
# Write item with identifier /foo/ to /foo/index.html
item.identifier + 'index.html'
@@ -356,10 +353,10 @@
data_source = site.data_sources[0]
# Create home page
data_source.create_item(
DEFAULT_ITEM,
- { :title => "Home" },
+ { :title => 'Home' },
'/'
)
# Create stylesheet
data_source.create_item(