0
0

webjarsでプラグインを組み込む

Last updated at Posted at 2023-11-04

gradleでプラグインを組み込む方法を記載します。
以下では、Bootstrap、Bootstrap-multiselectを組み込みます。
同時にHTML上でのバージョンの指定をwebjarsに依存させるため、webjars-locatorを利用します。
プラグイン情報は以下から検索することができます。

    implementation 'org.webjars:webjars-locator:0.42'

    implementation 'org.webjars.bower:bootstrap:4.5.3'

    implementation 'org.webjars.bower:bootstrap-multiselect:1.1.1'

Thymeleafでは、以下のようにth:srcに指定します。
ソースの場所は、Eclipseのプロジェクトの「パッケージ・エクスプローラー」上でも確認することができます。

bootstrap.png

<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" lang="ja">
<body>
<th:block th:fragment="comscripts">

  <!-- Bootstrap -->
  <script th:src="@{/webjars/bootstrap/dist/js/bootstrap.bundle.min.js}"></script>
  <script th:src="@{/webjars/bootstrap-multiselect/dist/js/bootstrap-multiselect.min.js}"></script>
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0