[英]Bundling Bootstrap 4 - Bootstrap tooltips require Tether
I have an app that's being built with Bootstrap 4. In this app, I have a Bower file, has the following: 我有一个使用Bootstrap 4构建的应用程序。在这个应用程序中,我有一个Bower文件,具有以下内容:
bower.json bower.json
{
"name": "myApp",
"version": "1.0.0",
"dependencies": {
"jquery": "2.1.4",
"tether": "1.2.0",
"bootstrap": "v4.0.0-alpha.5"
},
"private": true
}
I am trying to bundle these files with several custom JavaScript files. 我试图将这些文件与几个自定义JavaScript文件捆绑在一起。 In an attempt to do this, I have the following Gulp task: 为了做到这一点,我有以下Gulp任务:
gulpfile.js gulpfile.js
gulp.task('bundleJs', function() {
var jsFiles = [
'./bower_components/jquery/dist/jquery.min.js',
'./bower_components/tether/dist/tether.min.js',
'./bower_components/bootstrap/dist/js/bootstrap.min.js',
'./public/core.js',
'./public/utils.js'
];
return gulp.src(jsFiles)
.pipe(concat('bundle.js'))
.pipe(gulp.dest('./public/js'))
;
});
Then, in my web page, I'm referencing the file like this: 然后,在我的网页中,我正在引用这样的文件:
index.html 的index.html
<script type="text/javascript" src="/public/js/bundle.js"></script>
My web page loads and I can see that bundle.js has successfully loaded. 我的网页加载,我可以看到bundle.js已成功加载。 However, in the console window, I see the following error: 但是,在控制台窗口中,我看到以下错误:
Uncaught Error: Bootstrap tooltips require Tether 未捕获的错误:Bootstrap工具提示需要Tether
I believe that this is why my hamburger menu no longer works on mobile. 我相信这就是为什么我的汉堡菜单不再适用于手机。 My question is, is there a way to bundle these files together? 我的问题是,有没有办法将这些文件捆绑在一起? Or, do I need to load each individually? 或者,我是否需要单独加载每个?
I replicated your project. 我复制了你的项目。
The URL pointing to the tether JS file in you gulp file seems to be incorrect. 指向you gulp文件中的tether JS文件的URL似乎不正确。
It should be: 它应该是:
'./bower_components/tether/dist/js/tether.min.js',
instead of: 代替:
'./bower_components/tether/dist/tether.min.js',
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.