Concat scripts in order with Gulp

后端 未结 17 1514
后悔当初
后悔当初 2020-11-28 01:51

Say, for example, you are building a project on Backbone or whatever and you need to load scripts in a certain order, e.g. underscore.js needs to be loaded befo

17条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-28 02:47

    I had a similar problem recently with Grunt when building my AngularJS app. Here's a question I posted.

    What I ended up doing is to explicitly list the files in order in the grunt config. The config file will then look like this:

    [
      '/path/to/app.js',
      '/path/to/mymodule/mymodule.js',
      '/path/to/mymodule/mymodule/*.js'
    ]
    

    Grunt is able to figure out which files are duplicates and not include them. The same technique will work with Gulp as well.

提交回复
热议问题