babel CLI copy nonjs files

Babel has the copy files option for this:

babel src --out-dir lib --copy-files

Note: It is true that babels primary purpose is to process javascript files, but babel’s big suite of tools these day often makes it unnecessary to go for more complex build script setups as gulp and alike.
A gulp-less setup could be adding this to packages.json:

{
  ...
  "devDependencies": {
    "babel": "*",
    "babel-cli": "^6.4.0",
    "babel-preset-es2015": "^6.3.13"
  },
  "scripts": {
    "watch": "babel --watch src --out-dir lib --source-maps inline --copy-files",
    "build": "babel src --out-dir lib --source-maps inline --copy-files" 
  },
  "babel": {
    "presets": [
      "es2015"
    ]
  }
}

Leave a Comment

tech