0

i have lots of JavaScript files in different folders and want to add them to a master.js together. I have the following project structure:

/dist/js/master.js <-- Output file

/src/bootstrap-untouched/js <-- Bootstrap Plugins (alert.js, button.js etc.)
/src/js/plugins.js
/src/js/script.js

It would be good if I could activate and deactivate the individual bootstrap plugins. I do not want to use Grunt and Gulp. I use only the NPM. I think that would have to somehow work with browserify and uglifyjs.

1
  • 1
    "I do not want to use Grunt and Gulp" :( Commented Jan 25, 2016 at 12:50

2 Answers 2

1

In the source folder execute:

find . -name \*.js -type f -exec cat {} \; > ~/master.js

That is all.

Sign up to request clarification or add additional context in comments.

1 Comment

I had forgotten to say that it should go with the package.json. I want a task :-) When saving automatically master.js should be generated.
0

I'm assuming you've got some starter file (like entry.js - you can call it whatever you want actually).

In that case, this code should work:

var b = require('browserify')();

b.add('your entry js');

b.transform('uglifyify');

var indexjs = fs.createWriteStream('build/bundle.js');

b.bundle().pipe(indexjs);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.