Andreas
Andreas

Reputation: 1776

Best Practices to deploy javascript applications

I just started to think about the layout for the build environment of a javascript application that will become quite big in the future. I solved quite a lot of issues but one thing I still have not found a good solution for is the way how to deal with the script includes in my html pages. Maybe I am just plain stupid but I do not get it:

When developing the app I work with many little javascript files which all need to be included in my html page. When it comes to deployment I will combine/minfy all the javascript into a small number of script files. How do I deal with the changed number of script includes and the changed names of the includes? Do I adjust them manually? I hope not! Are there tools out there doing that job for me? Am I missing something very obvious?

BTW: The same problem is with CSS...

Any ideas and thoughts on this would be extremely helpful.

Upvotes: 4

Views: 5292

Answers (2)

Eugene Gluhotorenko
Eugene Gluhotorenko

Reputation: 3164

I use Grunt in my project. By means of Grunt you can write JS scripts to build your frontend applications. It lets you automate such tasks like minification, compilation, unit testing, linting and etc. Just use the search by plugins to find specific features.

Upvotes: 1

Davor Zubak
Davor Zubak

Reputation: 4746

I use Douglas Crockford JsMin to minify all my scripts to a single file on Release Build. Take a look at this site. I created batch file that is executed on every Release Build in my Visual Studio Solution. All files with .debug.js in their names are minified and saved to a .bundle.js file that is included in Html. You can even manage order of inclusion by defining number in file name so no wrong loading is occured.

Upvotes: 0

Related Questions