digilib icon indicating copy to clipboard operation
digilib copied to clipboard

Better way to build Javascript assets?

Open funkyfuture opened this issue 8 years ago • 2 comments

i was attempting to refactor the contents of webapp/src/main/webapp in order to have the digicat.html from jquery live in the root and to separate concerns (markup, javascript, styles). yet, the contents raise several questions:

  • how are the minified Javascript files generated?
  • how are third party libraries (jQuery, annotator-dl, json2, showndown) obtained and bundled?
    • how would they be upgraded?
  • are variants like digilib-mpiwg.html supposed to be maintained in this repository's master branch?
  • which purpose serve the jquery-test-* ans test-* files?
  • are the …/jquery/img/embedded/svg/* files excluded on purpose?

in order to ease contributions it's always helpful to have instructions how to build and test an application in the README.md or an extra CONTRIBUTING.md. also, i don't think that the way png files are generated would be reproducable for developers outside the mpiwg.

funkyfuture avatar Aug 22 '17 13:08 funkyfuture

how are the minified Javascript files generated?

Javascript and CSS is currently minified and bundled by the minify-maven-plugin in webapp/pom.xml

how are third party libraries (jQuery, annotator-dl, json2, showndown) obtained and bundled?

Currently all third-party libraries are just checked into the repo. For an update the files have to be replaced in the repo.

are variants like digilib-mpiwg.html supposed to be maintained in this repository's master branch?

In the past this was just part of my local deployment workflow. Now I think it would be better to have a separate branch for this.

which purpose serve the jquery-test-* ans test-* files?

These files are mostly remains of old experiments and testing sessions. It would also be nice if they could live in a separate branch.

Do you have examples for better branch structures to keep development files out of the main branch?

are the …/jquery/img/embedded/svg/* files excluded on purpose?

What do you mean by excluded?

The SVG sources for the button images and the build script that generates the images using XSLT and Inkscape are a bit of a mess. It would be nicer if we would put them somewhere else with some documentation for developers brave enough to re-generate the button images :-)

robcast avatar Aug 22 '17 17:08 robcast

Javascript and CSS is currently minified and bundled by the minify-maven-plugin in webapp/pom.xml

i'm not sure how this could be clarified. it is actually clear as one would expect that to be handled by the builder, but my uncertainty stemmed from the fact that source and resulting files lived in the same folder. therefore i suggest to move the sources to a separate location. as a sideeffect there'd be more lucidity in the codebase.

Currently all third-party libraries are just checked into the repo. For an update the files have to be replaced in the repo.

i will propably put this in an informational README in the source folder.

Do you have examples for better branch structures to keep development files out of the main branch?

it depends. if it's only you who is intended to use these, you could keep them locally and just exclude them from the vcs. if others are supposed to test their changes with them, they could live in a top level folder tests and test instructions would be needed - or preferably automated tests that can be triggered with one command invokation. the latter one is certainly a long-term goal. regarding web tests, i know that Selenium is the best bet, but not much more, especially in conjunction with Java applications.

What do you mean by excluded?

the embedded_icons.cmd refers to embedded\svg\*.svg which are not present in the repo.

a bit of a mess.

maybe it should be a privilige for the lion tamers to regenerate as long as this is the case. :-)

btw, i'll not have much capacities in the next weeks, so propably i'll also open a wip pr for that. you can intervene earlier that way, too.

funkyfuture avatar Aug 23 '17 14:08 funkyfuture