0

My nanoc content directory structure:

assets -> (css, images, files)
js
partials
[*.textile source files]

Extract from my rules file:

compile '/js/*/' do
    # don’t filter or layout
end
.
.
.
route '/js/*/' do 
  item.identifier.chop + '.' + @item[:extension].to_s
end

Command line result:

Message:

RuntimeError: Found 2 content files for content/js/bootstrap; expected 0 or 1

Compilation stack:

  (empty)

Stack trace:

  0. /home/tomc/.rvm/gems/ruby-2.1.1/gems/nanoc-3.7.1/lib/nanoc/data_sources/filesystem.rb:168:in `block in all_split_files_in'
  1. /home/tomc/.rvm/gems/ruby-2.1.1/gems/nanoc-3.7.1/lib/nanoc/data_sources/filesystem.rb:158:in `each_pair'
  2. /home/tomc/.rvm/gems/ruby-2.1.1/gems/nanoc-3.7.1/lib/nanoc/data_sources/filesystem.rb:158:in `all_split_files_in'
  3. /home/tomc/.rvm/gems/ruby-2.1.1/gems/nanoc-3.7.1/lib/nanoc/data_sources/filesystem.rb:86:in `load_objects'
  4. /home/tomc/.rvm/gems/ruby-2.1.1/gems/nanoc-3.7.1/lib/nanoc/data_sources/filesystem.rb:45:in `items'
  5. /home/tomc/.rvm/gems/ruby-2.1.1/gems/nanoc-3.7.1/lib/nanoc/base/source_data/site.rb:334:in `block in load_items'
  6. /home/tomc/.rvm/gems/ruby-2.1.1/gems/nanoc-3.7.1/lib/nanoc/base/source_data/site.rb:333:in `each'
  7. /home/tomc/.rvm/gems/ruby-2.1.1/gems/nanoc-3.7.1/lib/nanoc/base/source_data/site.rb:333:in `load_items'
  8. /home/tomc/.rvm/gems/ruby-2.1.1/gems/nanoc-3.7.1/lib/nanoc/base/source_data/site.rb:244:in `load'
  9. /home/tomc/.rvm/gems/ruby-2.1.1/gems/nanoc-3.7.1/lib/nanoc/base/source_data/site.rb:128:in `layouts'
  ... 27 more lines omitted. See full crash log for details.

I consulted How add own javascript file to nanoc?. I seem to be setting things up correctly, but my results say otherwise.

I cannot see the error. Anyone have any ideas?

Community
  • 1
  • 1
Tom Cloyd
  • 1
  • 2

1 Answers1

1

Because of the way it maps input filenames onto output paths, Nanoc requires the base name (i.e., the filename less extension) of each file under content to be unique. From Nanoc's perspective you are giving it two files that share the base name bootstrap and thus cannot have unique output paths, so it gives you this error.

Since what you really want is to have Nanoc copy over this portion of your site (the third-party JavaScript files) verbatim, it'd be better to move these files out of the content tree altogether and set up a static data source from which to load them. Then Nanoc will simply copy the files over as-is without trying to process or rename them. The "Troubleshooting" page on the Nanoc website has instructions on how to do this; see "Solution #2" under "Error: “Found 3 content files for X; expected 0 or 1”.