Giter Club home page Giter Club logo

escompile's Introduction

ExtendScript Compiler

Why?

To keep the development of large ExtendScript projects easier to handle I split the projects into multiple files/modules and use ExtendScript Preprocessor Directives to source those files in a base script. This works great for me but is a pain for users to install...

So, to make script installation as easy as possible I needed an automated way to get everything compiled into a single readable '.jsx' script file.

Previously I would just export to a JSXBIN file but I really wanted my open source scripts to be human readable...

How it works...

The script reads through the supplied .jsx script file looking for any 'include' statements and replaces them with contents from that file.

./escompile.sh sample_jsx_project/src/script.jsx > sample_jsx_project/compiledScript.jsx

โš ๏ธ You may need to make the script executable before running the command above.

What can it detect?

This script tries to process include and includepath statements just as the ExtendScript engine does.

include file

Inserts the contents of the named file into the output at the location of this statement.

๐Ÿ™Œ Nested include files starting in v0.3.0!

#include "../include/lib.jsxinc"
//@include "../include/file.jsxinc"

If the file to be included cannot be found, the script throws an error.

includepath path

One or more paths that the #include statement should use to locate the files to be included. The semicolon (;) separates path names.

If a #include file name starts with a slash (/), it is an absolute path name, and the include paths are ignored. Otherwise, the script attempts to find the file in any of the #includepath paths previously defined in your script.

#includepath "include;../include"
#include "file.jsxinc"
//@includepath "include;../include"
//@include "file.jsxinc"

Multiple #includepath statements are allowed; the list of paths updates each time an #includepath statement is executed.

Help

$ ./escompile.sh -h
usage: escompile.sh [-h] [--version] [FILE]

Compile modular ExtendScripts into a single human readable JSX file.

Arguments:
  [FILE]         Path of script file to compile from.

Options:
  -h, --help     Print this help message.
      --version  Print version.

Resources

Continuous Compilation

When developing ExtendScript scripts, I like to test from a compiled script, but running ExtendScript Compiler over and over gets old fast so I use Watchman. Mostly, I use the watchman-make command along with a project-specific Makefile to compile source code anytime I save a file in the projects source directory.

$ watchman-make -p 'src/**/*.jsx*' -t compile`

escompile's People

Contributors

joshbduncan avatar

Stargazers

Wang Weihua avatar  avatar  avatar songZ avatar Sergey Osokin avatar

Watchers

James Cloos avatar  avatar

Forkers

isabella232

escompile's Issues

Lost string

@joshbduncan after compilation, the last line is always removed from the original code. Example of my script.

#includepath "lib/" // Libraries folder
#include "base.jsx" // Base small functions
#include "generator.jsx" // Generator functions

function main() {
... // some code
}

// Run script
try {
  main();
} catch (err) {}

I'm getting this

... // included libs

function main() {
... // some code
}

// Run script
try {
  main();

lost-string

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.