Search code examples
javascriptgoogle-closurecompile-timeplovr

Run javascript at plovr compile-time


Is it possible to run javascript at compile time using plovr? (perhaps defining a variable in the config file).

For example, I would like a function that returns the time the script was compiled, something like this:

function compiledAt(){
    return #Date.now(); // #Date.now() to be processed at compile-time
}

So that after compilation, it would look like this:

function compiledAt(){
    return 1374580397271;
}

Solution

  • A few months later, I can update that it is not possible to do this using only javascript and Plovr.

    Other options include:

    1. A script that makes a replace and then runs plover
    2. A customer compiler pass in Google Closure