So, we are using Jawr in our Spring project and all is working well, except that when I try to include a single css file like this:
<jwr:style src="/assets/css/style2.css" />
It includes all the files in the css directory
<link rel="stylesheet" type="text/css" media="screen" href="/assets/css/non-responsive.css?d=35303629" />
<script type="text/javascript">/* The resource '/assets/css/non-responsive.css' is already included in the page. */</script>
<link rel="stylesheet" type="text/css" media="screen" href="/assets/css/style1.css?d=48250928" />
<link rel="stylesheet" type="text/css" media="screen" href="/assets/css/style2.css?d=444574087" />
<link rel="stylesheet" type="text/css" media="screen" href="/assets/css/style3.css?d=68336060" />
<script type="text/javascript">/* The resource '/assets/css/style3.css' is already included in the page. */</script>
<script type="text/javascript">/* Finished adding members resolved by /assets/css/style2.css */</script>
<script type="text/javascript">/* Start adding members resolved by '/assets/js/summary.js'. Bundle id is: '/assets/js/summary.js' */</script>
<script type="text/javascript" src="/assets/js/summary.js?d=82086305" ></script>
<script type="text/javascript">/* Finished adding members resolved by /assets/js/summary.js */</script>
This works well for single JS file as shown in the last two lines, but not for the CSS file for some reason. Am I missing something, or should I just be including the file the traditional way?
Because everything inside
assets/css/is considered a variant skin by Jawr, so it loads all files.You'll need to have only that style in the folder in order to load the single file.
For more information, see https://jawr.java.net/tutorials/howToUseJawrCssSkin.html , but the following part is an excerpt for your problem:
To define CSS skins, Jawr uses a directory hierarchy convention. The user needs to define the default CSS skin root directory. All the directory defined at the same level will be considered as a skin variant. To define the default skin root directory, the user must set the property jawr.css.skin.default.root.dirs. This property defines the list of default CSS root directories. So with Jawr, you can handle mutliple CSS skin root directories.
For instance, if you define the default skin root directory as : /css/skins/defaultSkin. And you have a directory structure like this :
If you set the Jawr configuration as:
Jawr will treat blueSkin and greenSkin as variants of defaultSkin.