factor1 / prelude-wp

Prelude is a WordPress starter theme that helps you craft custom themes.
GNU General Public License v3.0
14 stars 3 forks source link

ES6/Babel support by default #101

Closed erwstout closed 6 years ago

erwstout commented 7 years ago

Would like to update/add ES6/Babel support out of the box.

jeremyescott commented 7 years ago

ES6 is so pretty. I can't wait. Like default parameter values. Can you say, "finally!"?

bebaps commented 7 years ago

I agree and this is easy to do. Heres an example of how to implement it:

// Lint JavaScript
gulp.task('js:lint', () => {
    return gulp
    .src(SOURCES.js)
    .pipe($.plumber())
    .pipe($.babel())
    .pipe($.eslint())
    .pipe($.eslint.format())
    .pipe($.eslint.failAfterError());
});

it would be a good idea to add a es6 or babel folder though. By default Babel will take the source file and compile it in place, and for me that can lead to confusion if your not careful. So just like there is a scss folder that compiles its contents to css, we should have a es6 or something that compiles into js.

Also, I think we should revisit something I brought up before, and that is getting rid of jshint in favor of eslint. http://eslint.org/

erwstout commented 7 years ago

Quick update on this, for those who are waiting. We've been using/trying different methods of this on some projects to find the best workflow. Since jQuery and ES6 can sometimes clash, we're treading lightly. As of right now I'm thinking that we separate ES6 files from other JS files and have separate tasks for each. Any input would be appreciated.

erwstout commented 7 years ago

Delayed. This will be rolled out with release/5.0.0

erwstout commented 6 years ago

This is completed, but needs some extensive testing before deployment. If you want to test or try it out, you can install with npm: npm install factor1/prelude-wp#feature/es6

erwstout commented 6 years ago

Failed a lot of the testing, not sure the best approach forward. Will post more details soon.

erwstout commented 6 years ago

Closing for now 😭

We will leave it up to the dev to integrate ES6 if they want to.