[英]How to use jquery with brunch
我正在尝试设置主干应用程序,但出现“未定义$”错误。
Tree :
app :/
app.js
js :/
jquery.js
underscore.js
backbone.js
我有一个用于早午餐的config.coffee文件:
exports.config = paths:
public: 'www' files:
javascripts:
joinTo:
'js/atf.js': /^app/
order:
before: [
'app/js/jquery-2.0.2.min.js',
'app/js/underscore.js',
'app/js/backbone.js'
]
stylesheets:
joinTo:
'css/atf.css': /^app/
templates:
joinTo: 'js/atf.js'
我的index.html文件:
<!doctype html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="fr"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="fr"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9" lang="fr"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="fr" x-manifest="/manifest.appcache"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Test</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<link rel="stylesheet" type="text/css" media="all" href="/css/atf.css?v=2">
<script src="/socket.io/socket.io.js"></script>
<script src="/js/atf.js?v=3"></script>
<script>require('app');</script>
</head>
<body></body>
</html>
而我的app.js文件只是为了进行测试:
$(function(){
alert('test');
});
有人可以帮助我吗? 谢谢 !
将文件从app/js
移至vendor
(创建此目录)。 然后将javascripts.joinTo
更改为您在templates
中使用的同一地址。
这应该够了吧。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.