Cooks up your HTML resources for you.
Bakehouse:
Grab bakehouse from maven central:
<dependency>
<groupId>com.mangofactory</groupId>
<artifactId>bakehouse-core</artifactId>
<version>0.1.0</version>
</depenency>
Declare your resources in your jsp:
<%@ taglib prefix="bakehouse" uri="http://www.mangofactory.com/bakehouse" %>
<head>
<bakehouse:resource src="https://github.com/TheMangoFactory/bakehouse/raw/master/angular.js" cdn="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.min.js"/>
<bakehouse:resources configuration="javascript" type="text/javascript">
<bakehouse:resource src="https://github.com/TheMangoFactory/bakehouse/raw/master/file1.js"/>
<bakehouse:resource src="https://github.com/TheMangoFactory/bakehouse/raw/master/file2.js"/>
</bakehouse:resources>
<bakehouse:resources configuration="typescript" type="text/javascript">
<bakehouse:resource src="https://github.com/TheMangoFactory/bakehouse/raw/master/typescript.ts"/>
</bakehouse:resources>
Define a configuration:
@Configuration
@Profile("Production")
public class ExampleBakehouseConfig implements BakehouseConfigProvider {
@Override @Bean
public BakehouseConfig build(BakehouseConfigBuilder builder) {
return builder
.process("javascript").serveAsSingleFile("AppCode.js")
.process("typescript").with(new TypescriptProcessor("TypescriptCode.js"))
.serveResourcesFromCdn()
.build();
}
}
Deploy: In production, the above generates the following html:
<head>
<script src='http://ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.min.js' type='text/javascript'></script>
<script src='/bakehouse-example/generated/AppCode.js' type='text/javascript'></script>
<script src='/bakehouse-example/generated/TypescriptCode.js' type='text/javascript'></script>
</head>
Note - there's an actual working demo project available here
This project is currently a POC only. If you're interested, and wanna see it developed, you need to let me know! Add your voice to the conversation here