Open aesteve opened 9 years ago
So the pipeline interface could look like this :
public interface Pipeline {
public String rawPattern();
public String distDir();
public String transformName(String originalName);
public Buffer transform(Buffer originalContent);
}
In case of sass files for instance :
public class SassPipeline implements Pipeline {
public String rawPattern() {
return "web/raw/styles/*.scss";
}
public String distDir() {
return "web/dist/styles":
}
public String transformName(String originalName) {
return originalName.replace(".scss", ".css");
}
public Buffer transform(Buffer originalContent) {
// invoke sass compiler
return ...
}
}
What is a pipeline ?
It's a way to transform resources either at runtime (dev environment) or at startup or at build time (and then the framework doesn't care).
We could offer a pipeline API which would associate a resource to its built equivalent and map it to one single path. And then would transform it or not dependeing on the context.
Example
Pretty complicated to explain, not that easy to implement, but very useful.