6

again I have a problem with files in nanoc. This time I wanted to attach custom file slide.js to my blog but I cannot (don't know why - probably something is wrong with my routes). Here's my routes:

compile '/js/*/' do
  # don’t filter or layout
end

...

route '/js/*/' do
  /'js'/ + item.identifier.chop + '.js'
end

And in the head section of my layout I've put: %script{:type => "text/javascript", :src => "/js/slide.js"}/ (yes, it's a HAML).

Can anyone help me to solve this problem? It would be very appreciated.

lukaszkups
  • 5,790
  • 9
  • 47
  • 85

1 Answers1

2

okay, I think I've solved it:

compile '/javascripts/*/' do
  nil
end

...

route '/javascripts/*/' do
    item.identifier.chop + ".js"
end

If anyone knows better solution, feel free to put it here.

lukaszkups
  • 5,790
  • 9
  • 47
  • 85
  • 2
    Instead of using ".js" you can also use `item[:extension]`, which is the original file extension. Additionally, the `#compile` block does not need to return anything, so the `nil` is not useful. – Denis Defreyne Dec 25 '12 at 00:17