I’m creating a Grasemonkey user script that is getting really big.
Can I split it into several smaller files? If so, how?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, and in Greasemonkey, it’s rather easy. If you want to split your scripts into
i18n.js, autils.jsand your main script body (and had them in that order in the original script), just change your script header to read something like this:i18n.js:
utils.js:
my.user.js:
…and Greasemonkey will download and install all three files, join them up in the order listed by your
@requirestatements (main script last), and execute it as usual. Put them in the same directory on the server you distribute them from, or be sure to give full URLs in the@requirestatements to where they reside on the net.