0

I have a single HTML file in which I load a bunch of script files, like so:

index.html

  <script src="bower_components/angular-ui-router/release/angular-ui-router.min.js"></script>
  <script src="bower_components/angular-local-storage/dist/angular-local-storage.min.js"></script>
  <script src="bower_components/angular-route/angular-route.min.js"></script>
  <script src="bower_components/angular-animate/angular-animate.min.js"></script>
  <script src="bower_components/angular-loading-bar/build/loading-bar.min.js"></script>
  <script src="bower_components/angular-wizard/dist/angular-wizard.min.js"></script>
  <script src="bower_components/moment/moment.js"></script>
  <script src="bower_components/angular-moment/angular-moment.min.js"></script>
  <script src="bower_components/jquery/dist/jquery.min.js"></script>
  <script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
  <script src="bower_components/raphael/raphael.min.js"></script>
  <script src="bower_components/morris.js/morris.min.js"></script>
  <script src="bower_components/angular-morris-chart/src/angular-morris-chart.min.js"></script>
  <script src="jquery.js"></script>

I was wondering maybe there is a way to "require" all these in one script file like so:

bower_components.js

require('bower_components/angular-ui-router/release/angular-ui-router.min.js');
require('bower_components/angular-local-storage/dist/angular-local-storage.min.js');
etc ...

and later in production, compile bower_components.js to contain the actual scripts so that I could simply just use this:

 <script src="bower_components.js"></script>

Please note that I don't wish to run any sort of task in development environment. I don't want to compile my scripts when I work locally.

thanks in advance.

user3800799
  • 534
  • 1
  • 5
  • 18
  • This question has already been answered, see for example: http://stackoverflow.com/questions/24591854/using-gulp-to-concatenate-and-uglify-files – rbnvrw Jun 22 '16 at 09:52
  • Maybe you should try Googling before asking. See for example http://stackoverflow.com/questions/13713273/how-to-concatenate-and-minify-multiple-css-and-javascript-files-with-grunt-js-0 – rbnvrw Jun 22 '16 at 09:55
  • thanks, I already know what uglify is. It's not what I look for. read my post. – user3800799 Jun 22 '16 at 09:57
  • If you insist on using the `require` syntax, have a look at Browserify: http://browserify.org/ it will do what you are asking. – rbnvrw Jun 22 '16 at 10:10

0 Answers0