gulp安装依赖

建立一个package.json的文件

{

"name":"my-project-list",

"version":"1.0.0",

"description":"",

"main":"gulpfile.js",

"scripts": {

"test":"echo\"Error: no test specified\"&& exit 1"

},

"author":"",

"license":"ISC",

"devDependencies": {

"amd-optimize":"^0.6.1",

"gulp":"^3.9.1",

"gulp-concat":"^2.6.0",

"gulp-juicer-js":"^1.0.0",

"gulp-remove-logging":"^1.2.0",

"gulp-rename":"^1.2.2",

"gulp-sequence":"^0.4.6",

"gulp-strip-debug":"^1.1.0",

"gulp-uglify":"^2.0.0",

"gulp-useref":"^3.1.2"

}

}

sudo npm install

建立gulpfile.js

var 依赖=require('依赖名');

var baseUrl='../../../';

var amdOptimizeObj = {

paths:{//文件路径

jquery:baseUrl+'common/libs/jquery/jquery.min',

},

shim:{

lazyload:{

deps:[

'jquery',

],

},

bootstrap:{

deps:[//bootstrap的顺序在jquery之后

'jquery',

],

},

},

};

gulp.task('压缩方法名',function() {

gulp.src("./js/*.js")

.pipe(amdOptimize(baseUrl+'control/myFollowListControl',amdOptimizeObj))

.pipe(concat("my-follow-list.min.js"))

.pipe(stripDebug())//去掉调试

.pipe(uglify())

.pipe(gulp.dest('../../../../static/js/v6/user/myFollowList/'));

})

你可能感兴趣的:(gulp安装依赖)