Reputation: 3459
I'm not clear on how I should breakdown my code for large projects when using browserify. For instance, if I have a login page, signup page, dashboard, etc - do I require all of those modules in my main.js? And if so, what's the best practice for ensuring that modules that should only be run on the login page aren't run on other pages? Are there any good examples of how to breakdown larger projects when using browserify?
Upvotes: 0
Views: 359
Reputation: 4284
One possible example is to use browserify to compile two js files:
In the html just include the two files accordingly:
<html>
<header>
</header>
<body>
<!-- Common js libraries/modules used across a couple of pages -->
<script type="text/javascript" src="js/common_libraries.js"></script>
<!-- Page specific js file -->
<script type="text/javascript" src="js/modules_specific_to_this_page.js"></script>
</body>
</html>
Upvotes: 1