-5

I'm writing a JavaScript library and am wondering how I could license it such that developers/user:

  • must include the license (or a link to it)
  • can't minify the source code, but must include it as-is
  • must not bundle the file with other JavaScript files

Is there any off the shelf licenses that fit the bill? How might I write such a license if not?

My motivation is that I'd like my code to remain available at the point of delivery for pedagogical reasons — in the spirit of the early web era.

4
  • 4
    My gut feeling is that conditions two and three above are non-free, as they prevent distribution of modified versions, and that would make them off-topic for this site. Condition one is a requirement of nearly all free software licences already. That said, GPL is a licence that addresses minification by requiring on demand the distribution of the "preferred form of the work for making modifications to it", which in the case of JS, would be the unminified form. Would you settle for that?
    – MadHatter
    Mar 23, 2023 at 11:53
  • 4
    I’m voting to close this question because it is not about open source licensing. Mar 23, 2023 at 21:41
  • 2
    If you can live with people making modifications, on the condition they share the code in readable form (aka preferred form for editing), a copyleft license like GPL might be for you. Mar 23, 2023 at 23:21
  • Thank you all; I've no problem with modifications; I'm trying to make the distinction between a 'regular' modification and an obfuscation.
    – EoghanM
    Mar 27, 2023 at 22:01

1 Answer 1

4

There are no (open-source) licenses that meet your requirements and I am not sure if it is possible to write a license for them at all.

The inclusion of the license in distributing the JS library, even to the browser of end-users, is not an issue. That is actually a requirement of all open-source licenses (even if developers don't always follow that requirement).

The ban on minifying is not present in any open-source license. The best you can get with an off-the-shelf license is a requirement to tell where the source code can be obtained. You could (get a lawyer to) draft a license with such a restriction, but the chances are high that the license and thereby your library would not be accepted by the open source community.

The ban on bundling with other (JavaScript) files might actually step beyond the scope of copyright law and therefor what you can control with a copyright license. This requirement can also tremendously backfire, because it would also make it impossible to create a zip-file containing your library and some other libraries and send that around.

1
  • Thank you; I was thinking of the ban on bundling as a ban on concatenating it after unrelated possibly minified code (as a means of obfuscation)
    – EoghanM
    Mar 27, 2023 at 22:04

Not the answer you're looking for? Browse other questions tagged or ask your own question.