mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
resources concat and minify in production
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
package com.commafeed.frontend.resources;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.wicket.request.resource.AbstractResource;
|
||||
import org.apache.wicket.request.resource.IResource;
|
||||
import org.apache.wicket.request.resource.ResourceReference;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public abstract class UserCustomCssReference extends ResourceReference {
|
||||
|
||||
public UserCustomCssReference() {
|
||||
super(UserCustomCssReference.class, "custom.css");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IResource getResource() {
|
||||
return new AbstractResource() {
|
||||
@Override
|
||||
protected ResourceResponse newResourceResponse(Attributes attributes) {
|
||||
ResourceResponse resourceResponse = new ResourceResponse();
|
||||
resourceResponse.setContentType("text/css");
|
||||
resourceResponse.setTextEncoding("UTF-8");
|
||||
resourceResponse.setWriteCallback(new WriteCallback() {
|
||||
@Override
|
||||
public void writeData(Attributes attributes)
|
||||
throws IOException {
|
||||
attributes.getResponse().write(
|
||||
StringUtils.trimToEmpty(getCss()));
|
||||
}
|
||||
});
|
||||
return resourceResponse;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected abstract String getCss();
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.commafeed.frontend.resources;
|
||||
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import ro.isdc.wro.config.jmx.WroConfiguration;
|
||||
import ro.isdc.wro.http.WroServletContextListener;
|
||||
|
||||
public class WroListener extends WroServletContextListener {
|
||||
|
||||
@Override
|
||||
protected WroConfiguration newConfiguration() {
|
||||
WroConfiguration conf = super.newConfiguration();
|
||||
|
||||
boolean prod = Boolean.valueOf(ResourceBundle.getBundle("application")
|
||||
.getString("production"));
|
||||
|
||||
conf.setDisableCache(prod);
|
||||
conf.setDebug(!prod);
|
||||
return conf;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user