Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do i use the closurebuilder for compiling and minifying scripts

I am totally new to closure-library and am getting started. I just installed Python on my windows7 machine want to concatenate and minify the scripts. I ran through some commands as documented here but no gain. here are some parameters

  • Python installed in c:\python27\python.exe

  • Closure library in c:\closure\

  • Closure compiler in c:\closure\bin\build\compiler.jar

  • My Javascript file in D:\projects\closureapp\js\index.js

contents of the index.js is as below

/// <reference path="../closure/base.js" />
/// <reference path="../closure/dom/dom.js" />


/*Hello world into Closure Library Example*/

//Load the dom module
goog.require("goog.dom");


//refer the document body
var pageBody = document.body;

//after the body is loaded execute and add a header
pageBody.onload = function () {

    //create a header for the page
    var pageHeader = goog.dom.createDom('h1', { 'style': 'background-color:#EEE' }, 'Hello world!');

    //append the header to the document body
    goog.dom.appendChild(pageBody, pageHeader);

};

I executed the command below to produce compiled javascript but no gains

c:\python27\python.exe c:\closure\bin\build\c
losurebuilder.py --root=closure/ --root=d:\Projects\closureapp\js\ --
output_mode=compiled  --compiler_jar=compiler.jar > d:\Projects\closureapp\js\output.js

i get some weird messages like below

c:\closure\bin\build\closurebuilder.py: Building dependency tree..
Traceback (most recent call last):
  File "c:\closure\bin\build\closurebuilder.py", line 257, in <module> main()
  File "c:\closure\bin\build\closurebuilder.py", line 204, in main tree = depstree.DepsTree(sources)
  File "c:\closure\bin\build\depstree.py", line 56, in __init__ raise NamespaceNotFoundError(require, source)
  depstree.NamespaceNotFoundError: Namespace "goog.async.Deferred" never provided.
  Required in Source closure\messaging\portchannel.js
like image 308
Deeptechtons Avatar asked Oct 08 '22 10:10

Deeptechtons


1 Answers

This looks like the same issue as http://code.google.com/p/closure-library/issues/detail?id=316

like image 167
John Avatar answered Oct 13 '22 12:10

John