I'm writing a project, and there is a code that I would like to use, from here: https://developer.mozilla.org/es/docs/Web/JavaScript/Reference/Global_Objects/Set

The code is over CC0 licence, all fine, I would like to keep that licence, but at the same time I would like to change the license for the rest of the file, is there a way to do that? maybe add the first licence, then the code, other licence, and more code?

1 Answer 1


You should only have one license for each file. It is very confusing if within one file different parts have different licenses (I am not talking about dual-licensing here).

The best way to keep it with 2 different license terms is to keep it in 2 separate files.

The purpose of any code under CC0 license (or other public domain license terms) is to make it easy to embed it into anything else and to allow it to be distribute it with other license terms. That is the intention of the authors.

If you want to be good and generous (and I am a fan of that), when you include public domain code in your project you could give credits and add a link to the place where you copied the code.

  • Hi!, I want to keep the credits to them :3 so, in that case the best is made a new file, because even if I give the credits to them due to CC0 if I include a licence I'll get it, and I want to avoid it. Thx!
    – Abs_0_
    Dec 3, 2021 at 21:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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