javascriptgoogle-closure-compilergoogle-closureplovr

Using Plovr to compile modules


I am trying to compile my JavaScript files using Plovr as defined in the config file below:

{
  "id": "hello_demo",
  "paths": ".",  
  "closure-library": "closure-library/closure/goog/",
  "mode": "ADVANCED",
  "level": "DEFAULT",
  "pretty-print": true, 
  "externs": ["prototype.js"],
  "modules": {
    "core_scripts": {
      "inputs": "core_scripts.js",
      "deps": []
    },
    "add_new_item": {
      "inputs": "add_new_item.js",
      "deps": "core_scripts"
    }
  },
  "module-output-path": "build/module_%s.js"
}

I start the Plovr server using the command below:

java -jar c:/wf/my_project/plovr/plovr.jar serve c:/wf/my_project/js/plovr-config.js

I then go to http://localhost:9810/compile?id=hello_demo in the web browser and once it's finished compiling it shows me the compiled code of "core_scripts.js" only

I expect the compiler to have created two compiled JavaScript files in "c:/wf/my_project/js/build/" but there is nothing.

Am I missing something?

Thank you for your help in advance.


Solution

  • You are using the "serve" command of plovr, which just starts the server (and compiles it on the server without generating static files). You want to run the "build" command (with the same options) to generate the files on your local server, like so:

    java -jar c:/wf/my_project/plovr/plovr.jar build c:/wf/my_project/js/plovr-config.js