<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<script src="require.js" data-main="main.js"></script>
</head>
<body>
需要文件:require.js main.js css.min.js(require-css) Scripts/jquery-1.7.js
main.js内容:
<pre>
require.config({
paths: {
'jquery': ['Scripts/jquery-1.7']
},
urlArgs: 'ver=0.1.2',
map: {
'*': {
'css': 'css.min'
}
},
shim: {
jquery: {
deps: ['css!http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css']
}
}
});
require(['jquery'], function ($) {
console.log($);
})
</pre>
</body>
</html>
require.js加载js\css文件
最新推荐文章于 2024-08-10 07:08:24 发布