Guidelines for resolving static JavaScript dependencies

It is very sad that I have to ask this question in April 2012, but I know quite a few approaches to the problem.

So, I need a tool to statically compile javascript files that resolve dependencies. To be more precise, I need a tool (call him sometool) that can do the following:

  • scan folder, find all *.jsfiles
  • analyze these files and find a very simple synchronous and 100% compatible directive with it. By synchronous, I mean that there is no such thing as passing the onload handler - it is only preprocessing of static text. 100% js-compliant, I mean it looks like a comment from a js perspective - something like// @include
  • allow the paths used in the include directive using some configuration that can be configured .
  • substitute all include real output and put it in a separate folder.

I understand that all this seems obvious to most of you, but javascripters currently understand something a little different when they talk about dependency management - see require.js , for example.

+3
source share
2 answers

You should see sprockets . It can link and pack JavaScript files and includes support. You may need to write template code. There seems to be a script that allows you to run an asterisk from the command line bundled with it. And this is in Ruby. I do not know if this is a problem.

+3
source

Actually there is one answer, its name: Apache ANT

ANT like Make, is a tool that can do just about any job for you. Concatenate files, delete, read files / bends, minify, etc. Instructions are executed through XML files, many tasks are already present, but, of course, you can write your own tasks.

, . severval. : https://github.com/jAndreas/typeof-NaN-2.0/tree/master/build

javascript , , ( @import ). , javascript. , , - Apache, , .

, HTML5. 10%, .

+2

All Articles