如何将自己的javascript文件添加到nanoc? [英] How add own javascript file to nanoc?

查看:121
本文介绍了如何将自己的javascript文件添加到nanoc?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我再次遇到nanoc文件的问题。这次我想将自定义文件 slide.js 附加到我的博客,但我不能(不知道为什么 - 我的路线可能有问题)。这是我的路线:

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

并且在我的布局部分:%script {:type => text / javascript,:src => /js/slide.js} / (是的,这是一个HAML)。

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.

推荐答案

好吧,我想我已经解决了这个问题:

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.

这篇关于如何将自己的javascript文件添加到nanoc?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆