LoginSignup
2
2

More than 5 years have passed since last update.

Spark - mustacheでbootstrapを使う方法

Last updated at Posted at 2014-10-09
  • Sparkのテンプレートエンジンであるmustacheにbootstrap導入に少しハマったのでメモ

ハマった理由

  • JavaのほうでCSSやJSのファイルのパスを指定していなかった。
  • 指定の方法を知らなかった。
  • mustacheファイルでそのまま呼びだそうとしても出来ない!?← (localhost/hoge)にアクセスしていので当然といえば当然だが
  • 友達にeternalStaticFileLocationというものがあることを教えてもらったけどどうやって使うんだ...

解決方法

  • new File(".").getCanonicalPath()で追跡すればよかった
  • コード例
try{
    externalStaticFileLocation(new File(".").getCanonicalPath() + "/src/main/resources/templates");
}catch(IO Exception e){
}
  • あとはmustacheファイルのほうで呼び出せばおk

mustache.png

  • 読み込めてる
2
2
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
2
2