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

Multiple and Alternate Templating Engines #135

Open
anithri opened this issue Jan 7, 2018 · 0 comments
Open

Multiple and Alternate Templating Engines #135

anithri opened this issue Jan 7, 2018 · 0 comments

Comments

@anithri
Copy link
Collaborator

anithri commented Jan 7, 2018

@Drulac opened #134 to replace EJS with template-literal . Which is an idea I quite like, though I'm open to other opinions.

But what about allowing the ability for multiple template engines? If we moved the template processing from src/models/file-info.js into the (src/models/blueprint.js)[https://github.com/SpencerCDixon/redux-cli/blob/master/src/models/blueprint.js]?

We could provide template-literal (or ejs) as the default processor, if no other processors are defined. But allow specific file types to be processed by a specific engine, and for the entire rendering process to be redefined.

// willfully ignoring pomises for brevity
import postcss from 'somewhere';
import haml from 'haml';
const postCSS = postcss(['autoprefixer','cssnext']);
module.exports = {
  // ...
  engines: { 
    css: (contents, context) => {
      return processor(contents, context, options);
    }
  }
  preRender: () => (console.log('starting'));
  postRender: () => (console.log('done'));
};
@anithri anithri changed the title Alternate Templating Engines Multiple and Alternate Templating Engines Jan 7, 2018
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