Code Monkey home page Code Monkey logo

es5-compile's Introduction

es5-compile

Compiles ES6 to ES5 and minifies it using Googles Closure Compiler.

Usage:

es5-compile.py path_to_build.json

build.json format

Minimal build.json

{
  "output": "output.js"
}

This will take all files in the src directory and compile them into output.js

Source files

{
  "output": "output.js",
  "src": ["file1.js", "file2.js", "directory1", "directory2"]
}

src specifies a list of files and directories to be included in the compilation (order guaranteed). If you add a directory then all files in the directory and subdirectories will be included in alphabetical order. Only files ending in .js are included. If a file appears multiple times (e.g. you include the file and then the directory of the file), then it is only added the first time it is seen.

Exlude files

{
  "output": "output.js",
  "src": ["file1.js", "file2.js", "directory1", "directory2"],
  "exclude": ["directory1/bad_file.js", "directory2/bad_file_subdirectory"]
}

exclude specifies a list of files and directories to be excluded from the compilation. Is convenient when you want to include a whole directory except for a few files.

Header

{
  "output": "output.js",
  "header": "/* Copyright by Your Company */"
}

header adds some code in the beginning of your file

Adding additional Namespaces

{
  "output": "output.js",
  "src": ["src/libs"],
  "namespace": {
    "src/libs/engine.io.js": "BiggerLib.eio"
  }
}

namespace is a mapping from filename to an additional namespace prefix. For example, engine.io.js would export its module in the global namespace under eio. The config above would export it under BiggerLib.eio

Debugging

{
  "output": "output.js",
  "compile": false
}

If you set compile to false then the files are not compiled, but only concatenated into one big file. Convenient for debugging.

es5-compile's People

Contributors

andrin-n-dream avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.