Where to put static files for Spark Web Framework?

前端 未结 4 892
予麋鹿
予麋鹿 2020-12-08 07:21

Where do I put files when trying to serve static files with the Spark web framework?

I haven\'t been able to find anything online - I\'m beginning to suspect I don\'

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-08 08:01

    I put my style sheets below my static content as follows:

    staticFileLocation( "/web" );
    /web/
      |-- index.html
      +-- styles/
            +
            +--- default.css
    

    And the index.html

    ... 
    

    I also have other generated HTML pages as with freemarker. They just collect the path:

    • /styles/default.css, or
    • localhost:8081/styles/default.css

    Shows the CSS way index gets it.

    Source: https://groups.google.com/d/msg/sparkjava/5vMuK_5GEBU/vh_jHra75u0J

提交回复
热议问题