WARNING: Deprecated
The method of combining JavaScript files discussed on this page was designed in 2010, long before JavaScript had an import statement. It was replaced in CodeKit 3.8 with ES6 Module Bundling.
For backwards compatibility, CodeKit will always retain this older JS concatenation feature, but you should NOT use it for new projects.
Combining JS Files—Legacy Method
Special Comments
Special comments in your JS files tell CodeKit how to combine them. These comments let you prepend or append one JS file to another. They look like this:
// @codekit-prepend "someFile.js"; ... // @codekit-append "../someOtherFile.js";
You can also combine multiple files at once with a comma-separated list:
// @codekit-prepend "jQuery.js", "../otherFile.js";
The Quiet Keyword
Sometimes, you don't want the syntax checker to warn you about issues in linked files. Use the quiet keyword to automatically silence those issues:
// @codekit-prepend quiet "jQuery.js";
The keyword can appear anywhere on the special comment line and applies to all files on that line. This is equally valid:
// @codekit-prepend "jQuery.js", "otherFile.js" quiet;
Details
CodeKit creates a chain of JS files based on your prepend/append statements and then simply combines the content of each file in that chain, in order. The whole chain is then processed as one giant piece of JavaScript, whether you're syntax-checking, transpiling, or minifying.