在Sails管道中对Grunt concat和Uglify进行故障排除

时间:2016-04-01 13:47:50

标签: gruntjs grunt-contrib-uglify grunt-contrib-concat

我正在使用角度为1.5x的Sails.js应用程序进行前端处理。最近我开始使用textAngular,它在开发中运行良好,但是,由于某些原因在生产中运行,(我相信是问题)运行grunt concat和uglify,因此最小化所有js,我得到一个关于注入的js错误我的角度模块/应用程序。如果我删除对textAngular的所有引用,它将concat / uglify并在生产中正常运行。我想使用textAngular,并且不相信这是每个​​说法的问题。我应该如何解决此问题?是否有任何concat或uglify选项可以帮助我查明或解决问题?

其他信息: 注入textAngular的角度代码:

    var sangularApp =  angular.module('sangularApp', ['datatables', 'textAngular']).
    config(function($provide) { // provider-injector
      $provide.decorator('taOptions', ['$delegate', function(taOptions) { // $delegate is the taOptions we are decorating
        taOptions.toolbar = [
            ['pre', 'bold', 'italics', 'underline', 'strikeThrough','ol','insertLink', 'insertImage','html']
        ];
        return taOptions;
      }]);
    });

这是我得到的错误(当我在生产中运行并且文件被缩小时:

    Error: [$injector:modulerr] http://errors.angularjs.org/1.5.0/$injector/modulerr?p0=sangularApp&p1=%5B%24injector%3Aunpr%5D%20http%3A%2F%2Ferrors.angularjs.org%2F1.5.0%2F%24injector%2Funpr%3Fp0%3Da%0Ad%2F%3C%40http%3A%2F%2Fcutupcode.com%2Fmin%2Fproduction.min.js%3A10%3A1797%0APa%2Fo.%24injector%3C%40http%3A%2F%2Fcutupcode.com%2Fmin%2Fproduction.min.js%3A10%3A20234%0Ad%40http%3A%2F%2Fcutupcode.com%2Fmin%2Fproduction.min.js%3A10%3A18987%0Ae%40http%3A%2F%2Fcutupcode.com%2Fmin%2Fproduction.min.js%3A10%3A19221%0Ak%2F%3C.invoke%40http%3A%2F%2Fcutupcode.com%2Fmin%2Fproduction.min.js%3A10%3A19311%0Ad%40http%3A%2F%2Fcutupcode.com%2Fmin%2Fproduction.min.js%3A10%3A18448%0Aj%2F%3C%40http%3A%2F%2Fcutupcode.com%2Fmin%2Fproduction.min.js%3A10%3A18580%0Af%40http%3A%2F%2Fcutupcode.com%2Fmin%2Fproduction.min.js%3A10%3A2243%0Aj%40http%3A%2F%2Fcutupcode.com%2Fmin%2Fproduction.min.js%3A10%3A18357%0APa%40http%3A%2F%2Fcutupcode.com%2Fmin%2Fproduction.min.js%3A10%3A20389%0A_%2Fg%40http%3A%2F%2Fcutupcode.com%2Fmin%2Fproduction.min.js%3A10%3A9026%0A_%40http%3A%2F%2Fcutupcode.com%2Fmin%2Fproduction.min.js%3A10%3A9329%0A%24%40http%3A%2F%2Fcutupcode.com%2Fmin%2Fproduction.min.js%3A10%3A8641%0A%40http%3A%2F%2Fcutupcode.com%2Fmin%2Fproduction.min.js%3A14%3A26564%0Afa.Callbacks%2Fj%40http%3A%2F%2Fcutupcode.com%2Fmin%2Fproduction.min.js%3A2%3A7154%0Afa.Callbacks%2Fk.fireWith%40http%3A%2F%2Fcutupcode.com%2Fmin%2Fproduction.min.js%3A2%3A7927%0A.ready%40http%3A%2F%2Fcutupcode.com%2Fmin%2Fproduction.min.js%3A2%3A9741%0Ag%40http%3A%2F%2Fcutupcode.com%2Fmin%2Fproduction.min.js%3A1%3A1606%0A

1 个答案:

答案 0 :(得分:1)

如果没有一些调试信息或控制台错误,这是一个很难回答的问题。

根据您的提及,我的建议是回顾您的脚本并确保已包含textAngular的附加库,并且已正确完成将库注入模块。

如果没有应用这些工具,库工作正常,缩小和连接通常不会给我带来任何问题。