Javascript 一饮而尽
我使用Gulp连接我的插件,但它们似乎以错误的顺序缩小,导致我的应用程序崩溃。我使用的是“吞咽顺序”插件,我相信我使用的是正确的。为了测试,我禁用了uglify()。但是,生成的文件总是以Angular开头,而不是jQuery。任何帮助都将不胜感激Javascript 一饮而尽,javascript,jquery,angularjs,gulp,Javascript,Jquery,Angularjs,Gulp,我使用Gulp连接我的插件,但它们似乎以错误的顺序缩小,导致我的应用程序崩溃。我使用的是“吞咽顺序”插件,我相信我使用的是正确的。为了测试,我禁用了uglify()。但是,生成的文件总是以Angular开头,而不是jQuery。任何帮助都将不胜感激 ... //Gulp-order to make sure we load things correctly var order = require('gulp-order'); ... var pluginOrder = [ 'src/bowe
...
//Gulp-order to make sure we load things correctly
var order = require('gulp-order');
...
var pluginOrder = [
'src/bower_components/jquery/dist/jquery.js',
'src/bower_components/bootstrap/dist/js/bootstrap.js',
'src/bower_components/angular/angular.js',
'src/bower_components/angular-route/angular-route.js',
'src/bower_components/angular-animate/angular-animate.js',
'src/bower_components/angular-sanitize/angular-sanitize.js',
'src/bower_components/angular-bootstrap/ui-bootstrap.js',
'src/bower_components/angular-bootstrap/ui-bootstrap-tpls.js',
'src/bower_components/**/*.js',
'!src/bower_components/**/*.min.js'
]; //make sure everything loads in the right order
gulp.task('squish-jquery', function() {
return gulp.src( 'src/bower_components/**/*.js' )
.pipe(ignore.exclude([ "**/*.map" ]))
.pipe(order( pluginOrder )).on('error', gutil.log)
//.pipe(plugins.uglify().on('error', gutil.log))
.pipe(plugins.concat('jquery.plugins.min.js'))
.pipe(gulp.dest('build')).on('error', gutil.log);
});
连接文件jquery.plugins.min.js的开头:
/**
* @license AngularJS v1.3.15
* (c) 2010-2014 Google, Inc. http://angularjs.org
* License: MIT
*/
(function(window, angular, undefined) {'use strict';
/* jshint maxlen: false */
/**
* @ngdoc module
* @name ngAnimate
* @description
*
* The `ngAnimate` module provides support for JavaScript, CSS3 transition and CSS3 keyframe animation hooks within existing core and custom directives.
*
* <div doc-module-components="ngAnimate"></div>
*
* # Usage
*
* To see animations in action, all that is required is to define the appropriate CSS classes
* or to register a JavaScript animation via the `myModule.animation()` function. The directives that support animation automatically are:
* `ngRepeat`, `ngInclude`, `ngIf`, `ngSwitch`, `ngShow`, `ngHide`, `ngView` and `ngClass`. Custom directives can take advantage of animation
* by using the `$animate` service.
*
* Below is a more detailed breakdown of the supported animation events provided by pre-existing ng directives:
*
* |
/**
*@license AngularJS v1.3.15
*(c)2010-2014年谷歌公司。http://angularjs.org
*执照:麻省理工学院
*/
(函数(窗口,角度,未定义){'use strict';
/*jshint-maxlen:false*/
/**
*@ngdoc模块
*@name ngAnimate
*@说明
*
*“ngAnimate”模块在现有的核心指令和自定义指令中支持JavaScript、CSS3转换和CSS3关键帧动画挂钩。
*
*
*
*#用法
*
*要查看实际的动画,只需定义适当的CSS类
*或者通过“myModule.animation()”函数注册JavaScript动画。自动支持动画的指令有:
*`ngRepeat`、`ngInclude`、`ngIf`、`ngSwitch`、`ngShow`、`ngHide`、`ngView`和`ngClass`。自定义指令可以利用动画
*通过使用“$animate”服务。
*
*以下是先前存在的ng指令提供的受支持动画事件的更详细细分:
*
* |
我从未使用过gulp order,但我只是按如下方式将其串联起来:
gulp.task('js', function(done) {
return gulp.src([
'./bower_components/angular/angular.js',
'./bower_components/angular-bootstrap/ui-bootstrap.js',
'./bower_components/angular-bootstrap/ui-bootstrap-tpls.js',
'./bower_components/angular-collection/angular-collection.js',
'./assets/js/shopApp.js',
'./assets/js/**/*.js'
])
.pipe(concat('all.js'))
//.pipe(uglify())
//.pipe(sourcemaps.write())
.pipe(gulp.dest('public/js/'))
.pipe(notify('js updated!!'));
});
我本来是这样做的,但我遇到了同样的问题,这导致我得到了插件。很抱歉,当时我试图检查差异,但没有找到任何结果…只有plugins.concat您使用感谢您的帮助!