However, if you’re adhering to non-native module systems that browsers can’t interpret like CommonJS or AMD (or even native ES6 module formats), you’ll need to use a specialized tool to convert your modules into properly-ordered browser-friendly code. All you’re really doing is mashing together a bunch of plain vanilla JavaScript code. What are the different ways to bundle modules?Ĭoncatenating and minifying your files works great when you’re using one of the standard module patterns (discussed in the previous post) to define your modules. Task runners like Gulp and Grunt make concatenation and minification straightforward for developers, ensuring that human-readable code stays exposed for developers while machine-optimized code gets bundled for browsers. If you’ve ever seen a file that had a “min” extension like “ underscore-min.js”, you probably noticed that the minified version is pretty tiny (and unreadable) compared to the full version. Less data means less browser processing time, which in turn reduces the time it takes to download files. whitespace, comments, new line characters, etc.), in order to reduce the overall size of the content without changing the functionality of the code. Minification is the process of removing unnecessary characters from source code (e.g. When you hear developers talking about the “build step” or “build process,” this is what they’re talking about.Īnother common approach to speed up the bundling operation is to “minify” the bundled code. To get around this problem, we bundle, or “concatenate” all our files into one big file (or a couple files as the case may be) in order to reduce the number of requests. Having sep arate
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |