googlearchive / seed-element

Polymer element boilerplate
278 stars 78 forks source link

Integration of transpilable DSL within seed-element dev workflow #88

Open hickscorp opened 8 years ago

hickscorp commented 8 years ago

I've been asking this question several times on slack @Polymer without an answer, maybe the maintainers of PSE have informations.

What would be the recommended way to use DSL (Eg Jade, HAML, Coffee etc), and even ES2015 within a seed-element based repository, allowing Polyserve to correctly run, while publishing the correct transpiled files when other people use the element? Would that require the integration of a proper Gulpfile? Or is there anything already recommended regarding that?

robdodson commented 8 years ago

@justinfagnani would be a good person to ask. For the ES2015 I think the easiest thing might be to keep the js for your element separate and transpile it. So if you have x-foo.es6.js which transpiles to x-foo.js, which is what your element depends on, then you should be able to serve that just fine with polyserve.

justinfagnani commented 8 years ago

You don't need to put ES2015 code in a separate file, but you do have to strip it out to compile with Babel. I tend to do this in a Gulp rule with Crisper, then gulp-if to send the JS through Babel.

hickscorp commented 8 years ago

@robdodson @justinfagnani Thanks for the hints. So basically, the workflow would be:

@justinfagnani Would you be kind enough to show us a Gulpfile doing that? I am aware of the Polymer Starter Kit Gulpfile, but it seems maybe too big and bloated for a simple Polymer Seed Element, what do you think?

Just to make sure it's correct:

Edit: One thing I'm not too sure about: what would be the recommended directory structure for such setup? Having all coffee / ES2015 in an src/ directory but getting them transpiled in the root / directory? Or something else? Also, would the vulcanization be involved in that process, or do you recommend only running it from an application project directory?

When I have such pattern (Multiple things to be ran in parallel), I usually use foreman. Would you recommend such approach? Does it sound too complicated for newcomers maybe?