Should minified JavaScript files be in the git repository?
  • Vote Up0Vote Down Daniel JamesDaniel James
    Posts: 844Member, Sourcefabric Team
    Hi all,

    Booktype source currently contains around 120 minified JavaScript files. Although some tools are available to make these files more readable, they are hard to follow on sites like GitHub. Debian has a policy that source should contain unminified equivalents. At the same time, our other JavaScript files are unminified, so we might be missing out on potential performance benefits for users.

    If we were to maintain files in the unminified state, and only minify them when creating release tarballs, that would break links in our templates. I don't think it is practical to include both minified and unminified versions in the source, in case they get out of sync.

    Is the most practical solution for the tarball release script to first minify all JavaScript, and then update template links to minified versions?

    Cheers!

    Daniel
  • 1 Comment sorted by
  • Hi Daniel!

    I would say that correct way would be to have unminified source files in our repository also. 

    We are using django-compressor library which does compresson and modification for most of the JavaScript in the production profile. That is done after the installation is done and problem with it is you need all the additional minification tools at this step. That is not what you asked but maybe that would be the solution. Always have unminified source and do it only at the deployment if you want. Because deployment has minified and unminified version at the same time. Depending of the profile it will host correct version. This way you can switch to dev profile and debug the source more easily.


    Aco