ksherlock / better-babel-cli

a better babel command-line utility
11 stars 0 forks source link

Watch mode. #18

Closed philipyoungg closed 7 years ago

philipyoungg commented 7 years ago

Love this. Is there any watch mode built-in? using watch doesn't do anything

ksherlock commented 7 years ago

There currently isn't any sort of watch functionality built in. You could use a standalone watch utility to handle that. e.g. , facebook's watchman (I haven't actually tried this):

watchman -- trigger /path/to/dir triggername '*.js'-- babel --babel-flags -- 

which should call it every time a .js file is modified.

I'll think about building in support directly.

philipyoungg commented 7 years ago

@ksherlock thanks for your recommendation. I researched and ended using fswatch. filewatcher src/*.js 'rollup src/index.js | babel --es2015 | uglifyjs -m -c > app.min.js'

now much better! It's also amazing better-babel-cli can pipe files, unlike default babel cli.

ksherlock commented 7 years ago

I'm glad to hear it's working for you. There's a --babili flag which will do some minimization as well I'm not sure how well it compares to uglify.