Skip to main content
 首页 » 编程设计

express之Jade : How to include a javascript file

2024年04月30日19daizhj

我需要在网页中包含一个 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 (e.g. "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> 

怎么做?

请您参考如下方法:

将其放入您的 jade 文件中:

脚本(src="/Scripts/jquery.timeago.js")