Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a pipeline API #30

Open
aesteve opened this issue Apr 20, 2015 · 1 comment
Open

Provide a pipeline API #30

aesteve opened this issue Apr 20, 2015 · 1 comment
Assignees
Milestone

Comments

@aesteve
Copy link
Owner

aesteve commented Apr 20, 2015

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

If we're on a dev environment :

When the user asks for assets/*.css, look for web/styles/*.scss, then send invoke my transform function and return the result.

If we're on a production environment :

Look for every file in web/styles/*.scss, if you fin their equivalent into dist/styles/*.css then it's OK, serve directly those files when assets/*.css is asked. If some are missing, please invoke my transformation function and save the result.

Pretty complicated to explain, not that easy to implement, but very useful.

@aesteve aesteve self-assigned this Apr 20, 2015
@aesteve aesteve added this to the 0.1 milestone Apr 20, 2015
@aesteve
Copy link
Owner Author

aesteve commented Apr 20, 2015

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 ...
    }
}

@aesteve aesteve modified the milestones: 0.2, 0.1 Jun 29, 2015
@aesteve aesteve modified the milestones: 0.2, 2.0 Dec 21, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant