Since beta Bootstrap 4 doesn't depend on Tether but Popper.js. All scripts (must be in this order):
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
See the current documentation for the newest script versions.
Bootstrap 4 alpha needs Tether, so you need to include tether.min.js
before you include bootstrap.min.js
, eg.
<script src="https://npmcdn.com/[email protected]/dist/js/tether.min.js"></script>
<script src="https://npmcdn.com/[email protected]/dist/js/bootstrap.min.js"></script>
If you're using Webpack:
webpack.config.js:
plugins: [
<... your plugins here>,
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery",
"window.jQuery": "jquery",
"window.Tether": 'tether'
})
]
Source
If you are using npm and browserify:
// es6 imports
import tether from 'tether';
global.Tether = tether;
// require
global.Tether = require('tether');
Personally I use small subset of Bootstrap functionality and don't need to attach Tether.
This should help:
window.Tether = function () {
throw new Error('Your Bootstrap may actually need Tether.');
};
If you want to avoid the error message and you are not using Bootstrap tool tips, you can define window.Tether before loading Bootstrap.
<script>
window.Tether = {};
</script>
<script src="js/bootstrap.min.js"></script>
You should done my guideline:
1. Add bellow source into Gemfile
source 'https://rails-assets.org' do
gem 'rails-assets-tether', '>= 1.1.0'
end
Run command:
bundle install
Add this line after jQuery in application.js.
//= require jquery
//= require tether
Restart rails server.
Install tether via npm like below
npm install tether --save-dev
then add tether to your html above bootstrap like below
<script src="node_modules/tether/dist/js/tether.min.js"></script>
<script src="jspm_packages/github/twbs/[email protected]/js/bootstrap.js"></script>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With