I am trying to implement an option for the user to set his own CSS in the front end.
I created an XPage like this:
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" rendered="false">
<xp:this.afterRenderResponse><![CDATA[#{javascript:
var externalContext = facesContext.getExternalContext();
var writer = facesContext.getResponseWriter();
var response = externalContext.getResponse();
response.setContentType("text/css");
response.setHeader("Cache-Control", "no-cache");
var param = context.getUrlParameter("myParam");
//HERE I WILL READ THE USER FIELD
writer.write("body{font-size:100pt;}");
writer.endDocument();
}]]>
</xp:this.afterRenderResponse>
</xp:view>
If I try to implement the CSS (XPage) like this
<xp:styleSheet href="/myCssXPages.xsp"></xp:styleSheet>
everything works fine until I set the property xsp.resources.aggregate to true. If I try to implement the file like this:
<xp:linkResource type="text/css" loaded="true" href="./myCssXPages.xsp">
<xp:this.attrs>
<xp:attr name="rel" value="stylesheet" loaded="true"></xp:attr>
</xp:this.attrs>
</xp:linkResource>
It could work, because now every CSS file will be aggregate except this file, but the order is wrong. This file is always loaded before the aggregated files are loaded but I need this file at the last position.
Is there any solution to set the order of the resources or why I can't use a XPage as CSS resource with aggregate true? Or is there another solution to implement a functionality like this?
UPDATE
The user created an settings document where he got a textfield. So he will save his css as string in an document.
I created also some default css file resources. But when the user sets his own css config, this shut override the content from the default files resources.
I can't use themes because themes are also implemented befor the aggregated css files a implemented.