A
A
Alexander Wolf2013-03-08 14:37:36
JavaScript
Alexander Wolf, 2013-03-08 14:37:36

Combining JS files into one?

Hello! Perhaps this topic has already been discussed many times, but could you suggest a library for nodeJS to combine similar JS files:

//#include init.js
//#include config.js

init(function () {
    config();
});

Answer the question

In order to leave comments, you need to log in

6 answer(s)
A
Alexander Keith, 2013-03-09
@mannaro

I'll offer my suggestion -

$ npm install includejs -g
$ ijs import -files myfile.js -output done.js
# или так, все файлы в дериктории:
$ ijs import -files builds/*.js -output lib/

Examples
source
script for includejs
result

V
Vitaliy Petrychuk, 2013-03-08
@vermilion1

github.com/mape/connect-assetmanager
github.com/mishoo/UglifyJS/
github.com/gruntjs/grunt-contrib-concat (needs grunt)

Z
ZooBestik, 2013-03-09
@ZooBestik

You can look at the Yandex operating time - borschik , it roughly does this.

D
Dmitry_f, 2013-03-08
@Dmitry_f

You can use grunt for this purpose. I wrote a small homemade.js lib that does exactly what you need (there was exactly the same task). It works both as a plugin for grunt and through the console. Just start node homemade.js input.js output.js. In general, the component approach through component
is gaining popularity now , but it takes time to learn.

V
vittore, 2013-03-08
@vittore

I think r.js is what you are looking for.
You can read more here.

A
Alexey, 2013-03-09
@Ag47

It looks like you are looking for something similar to Sprockets from RnR for a node, for the so-called connect-assets.
One of the analogues of snockets
#= require dependency

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question