Open hysryt opened 6 years ago
$ mkdir my && cd my
$ npm init -y
$ npm install bootstrap@4.0.0-beta.2
$ npm install jquery popper.js
新しくnpmパッケージを作成し、bootstrap4をインストール
bootstrap@4.0.0-beta.2
はjquery
、popper.js
に依存しているため、一緒にインストール
sassのエントリポイントはnode-modules/bootstrap/scss/bootstrap.scss
コンパイル後のCSSはnode-modules/bootstrap/dist/css/bootstrap.css
bootstrapで使用する変数が定義されているファイル
ほぼ全ての変数に!default
フラグが付与されている
!default
はすでに定義されている場合は上書きしないというフラグ
そのため、変数の値をカスタマイズしたい場合はbootstrap.scss
を読み込む前に変数値を定義しておく
data-ride="carousel"
をつけると自動でページ送りされる
<div id="garally" class="carousel slide" data-ride="carousel">
...
</div>
ページ送りのインターバルを変える場合はdata-interval
指定する
デフォルトは5000
ミリ秒
<div id="garally" class="carousel slide" data-ride="carousel" data-interval="1000">
...
</div>
日付入力フォーム https://github.com/uxsolutions/bootstrap-datepicker
$ npm install bootstra-datepicker
require('bootstrap-datepicker');
require('./node_modules/bootstrap-datepicker/dist/locales/bootstrap-datepicker.ja.min.js');
$(function() {
$('input').datepicker({
language: 'ja'
});
});
@import './node_modules/bootstrap-datepicker/dist/css/bootstrap-datepicker3.css';
bootstrap-datepicker.css
ではなく bootstrap-datepicker3.css
インストール
bootstrap
、jquery
、popper.js
をインストール (2017/01/18 Bootstrap4安定版リリース)もととなるスクリプトファイルの作成
browserifyでスクリプトファイルを一つにまとめる
HTMLファイルから読み込み