Jade:如何包含一个JavaScript文件

我需要包含一个JavaScript文件到网页。 我写了以下内容:

include /../scripts/jquery.timeago.js 

但是我明白了

 <script>/* * timeago: a jQuery plugin, version: 0.8.2 (2010-02-16) * @requires jQuery v1.2.3 or later * * Timeago is a jQuery plugin that makes it easy to support automatically * updating fuzzy timestamps (eg "4 minutes ago" or "about 1 day ago"). * * For usage and examples, visit: * http://timeago.yarp.com/ * * Licensed under the MIT: * http://www.opensource.org/licenses/mit-license.php * * Copyright (c) 2008-2010, Ryan McGeary (ryanonjavascript -[at]- mcgeary [*dot*] org) */ (function($) { .... </script> 

结果。 但是我需要:

 <script src="/Scripts/jquery.timeago.js" type="text/javascript"></script> 

怎么做?

把这个放在你的玉档里:

script(src="/Scripts/jquery.timeago.js")

你可以把这个代码放在你的玉文件中:

  script(type='text/javascript' src='public/vendor/jquery/jquery.min.js') 

另外,如果你想在你的jade文件中包含内联js,你也可以这样做:

 script(type="text/javascript"). console.log('hello world');