如何在凉亭中使用jQuery UI? [英] How to use jquery ui with bower?
问题描述
我使用以下命令创建了一个yeoman Web应用程序
I have created a yeoman webapp using the following command
yo webapp
我想使用 jqueryui ,所以我已经使用Bower安装了它:
I want to use jqueryui so I have installed it using bower:
bower install jquery-ui --save
这很好用,但是jQuery UI组件不包含带有所有"组件的javascript文件,它仅包含许多javascript文件,每个组件一个.
This works fine, but the jQuery UI component doesn't contain a javascript file with "all" the components, it just contains a lot of javascript files, one for each component.
我应该只包含所需的javascript文件吗?还是在使用jQuery UI之前我应该做其他事情?
Should I include only the javascript files that I need? Or should I do something else before using jQuery UI?
感谢您的提示!
推荐答案
在bower.json
(或component.json
)的dependencies
中将jquery-ui
与jquery
一起添加.
Added jquery-ui
in dependencies
of bower.json
(or component.json
) along with jquery
.
{
…,
"dependencies": {
"jquery": "~1.9.1",
"jquery-ui": "~1.10.3",
...
},
…
}
安装它们:
bower install
然后,在main.js
中添加到jqueryui
的路径并要求它:
Then, added path to jqueryui
In main.js
and require it:
require.config({
paths: {
jquery: '../components/jquery/jquery',
jqueryui: '../components/jquery-ui/ui/jquery-ui',
…
},
shim: {
jqueryui: 'jquery',
…
},
…
});
require(['app', 'jquery', 'jqueryui', 'bootstrap'], function (app, $) {
'use strict';
...
});
对我有用.
这篇关于如何在凉亭中使用jQuery UI?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!