Question

Recently I was testing this library:

https://github.com/webjars/dojo

which is great since I can bring dojo to my project as a maven library. However the problem is that is a little bit difficult to debug without the uncompressed files. I know that one way of using uncompressed files is overriding the file dojo.js.uncompressed.js. To do that I copy dojo.js.uncompressed.js file and paste it inside the folder:

webapp/webjars/dojo/1.9.2/dojo

with the same name as dojo.js.uncompressed.js, and in the line 1012 I changed:

        // if result is not absolute, add baseUrl
        if(!(/(^\/)|(\:)/.test(url))){
            url = baseUrl + url;
        }

by:

// if result is not absolute, add baseUrl
if (!(/(^\/)|(\:)/.test(url))) {
    url = baseUrl + url;
    // if the url begins with "webjas/dojo" and ends with ".js" add ".js.uncompessed"
    if (/^webjars\/dojo\/.+\.js$/.test(url)) {
        url += '.js.uncompressed';
    }
}

Although this solve the problem of using uncompressed files, it is a uggly solution. I know that other way could be override define and require functions, but that would be more difficult to achieve.

So basically I was wondering if there is a way to use source maps with dojo webjars to avoid previous hack.

Was it helpful?

Solution 2

Now is possible to use source code of dojo libraries, you just need to use the dependency that says "-src", ie.:

http://github.com/webjars/dojo-src

althouth, there is "1.9.4" version it contains version "1.9.3", so you should use version "1.9.3".

OTHER TIPS

Not sure why you need to use webjars, the latest dojo build is available directly from maven

http://search.maven.org/#artifactdetails|org.dojotoolkit|dojo|1.9.3|pom

Other than that, if you need to modify the source code for whatever reason, you can download the uncompressed files, make your edit, zip them up and stick the zip file in your repository. In your maven-war-plugin configuration, you can then just add the dependency as an overlay, and it will deploy to the path of your choosing:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-war-plugin</artifactId>
  <version>2.4</version>
  <configuration>
    <useCache>true</useCache>
    <overlays>
      <overlay>
        <groupId>org.dojotoolkit</groupId>
        <artifactId>dojo</artifactId>
        <type>zip</type>
        <targetPath>js/</targetPath>
      </overlay>
    </overlays>
  </configuration>
</plugin>
...
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top