grunt-aws 不处理任何文件
grunt-aws Not Processing Any Files
我正在尝试使用以下方法自动将文件上传到 S3 存储桶:https://github.com/jpillora/grunt-aws#the-s3-task
我的 Gruntfile.js "compiles" 是正确的,但是执行时它只是在到达 S3 部分时挂起 -- 没有错误。
以下是我的Gruntfile.js:
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
aws: grunt.file.readJSON('aws.json'),
concat: {
options: {
separator: '\n',
stripBanners: {
block: true
}
},
scripts: {
src: [
'scripts/bootstrap.js',
'scripts/bootstrap-select.js',
'scripts/bootbox.js',
'scripts/app.js',
'scripts/jquery.validate.js',
'scripts/additional-methods.js',
'scripts/captcha.js',
'scripts/mail.js',
'scripts/render.js'
],
dest: 'scripts/bundle.js'
},
style: {
src: [
'style/jquery-ui.css',
'style/bootstrap.css',
'style/bootstrap-select.css',
'style/en-us.css'
],
dest: 'style/bundle.css'
}
},
uglify: {
options: {
banner: '/*! <%= grunt.template.today("dd-mm-yyyy") %> */\n',
mangle: {
except: ['jQuery']
}
},
scripts: {
files: {
'scripts/bundle.min.js': 'scripts/bundle.js'
}
}
},
cssmin: {
target: {
files: [{
expand: true,
cwd: 'style',
src: ['bundle.css'],
dest: 'style',
ext: '.min.css'
}]
}
},
s3: {
options: {
accessKeyId: '<%= aws.key %>',
secretAccessKey: '<%= aws.secret %>',
bucket: '<%= aws.bucket %>',
region: '<%= aws.region %>',
access: 'public-read'
},
upload: {
headers: {
CacheControl: 604800,
Expires: new Date(Date.now() + 604800000).toUTCString()
},
cwd: "/",
src: "**"
}
}
});
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-aws');
grunt.registerTask('default', ['concat', 'uglify', 'cssmin', 's3']);
};
sudo grunt s3 -v --force的关联输出如下:
Loading "cloudfront.js" tasks...OK
+ cloudfront Loading "route53.js" tasks...OK
+ route53 Loading "s3.js" tasks...OK
+ s3 Loading "aws.js" tasks...OK
No tasks were registered or unregistered. Loading "cache-mgr.js" tasks...OK
No tasks were registered or unregistered. Loading "Gruntfile.js" tasks...OK
+ default
运行 任务:s3
运行"s3"任务
运行 "s3:upload" (s3) 任务验证 属性 s3.upload 存在于
配置...确定
到那时,它挂了...
有什么想法吗?
这一行有问题:cwd: "/"
应该是cwd: "."
我正在尝试使用以下方法自动将文件上传到 S3 存储桶:https://github.com/jpillora/grunt-aws#the-s3-task
我的 Gruntfile.js "compiles" 是正确的,但是执行时它只是在到达 S3 部分时挂起 -- 没有错误。
以下是我的Gruntfile.js:
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
aws: grunt.file.readJSON('aws.json'),
concat: {
options: {
separator: '\n',
stripBanners: {
block: true
}
},
scripts: {
src: [
'scripts/bootstrap.js',
'scripts/bootstrap-select.js',
'scripts/bootbox.js',
'scripts/app.js',
'scripts/jquery.validate.js',
'scripts/additional-methods.js',
'scripts/captcha.js',
'scripts/mail.js',
'scripts/render.js'
],
dest: 'scripts/bundle.js'
},
style: {
src: [
'style/jquery-ui.css',
'style/bootstrap.css',
'style/bootstrap-select.css',
'style/en-us.css'
],
dest: 'style/bundle.css'
}
},
uglify: {
options: {
banner: '/*! <%= grunt.template.today("dd-mm-yyyy") %> */\n',
mangle: {
except: ['jQuery']
}
},
scripts: {
files: {
'scripts/bundle.min.js': 'scripts/bundle.js'
}
}
},
cssmin: {
target: {
files: [{
expand: true,
cwd: 'style',
src: ['bundle.css'],
dest: 'style',
ext: '.min.css'
}]
}
},
s3: {
options: {
accessKeyId: '<%= aws.key %>',
secretAccessKey: '<%= aws.secret %>',
bucket: '<%= aws.bucket %>',
region: '<%= aws.region %>',
access: 'public-read'
},
upload: {
headers: {
CacheControl: 604800,
Expires: new Date(Date.now() + 604800000).toUTCString()
},
cwd: "/",
src: "**"
}
}
});
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-aws');
grunt.registerTask('default', ['concat', 'uglify', 'cssmin', 's3']);
};
sudo grunt s3 -v --force的关联输出如下:
Loading "cloudfront.js" tasks...OK + cloudfront Loading "route53.js" tasks...OK + route53 Loading "s3.js" tasks...OK + s3 Loading "aws.js" tasks...OK
No tasks were registered or unregistered. Loading "cache-mgr.js" tasks...OK No tasks were registered or unregistered. Loading "Gruntfile.js" tasks...OK + default
运行 任务:s3
运行"s3"任务
运行 "s3:upload" (s3) 任务验证 属性 s3.upload 存在于 配置...确定
到那时,它挂了...
有什么想法吗?
这一行有问题:cwd: "/"
应该是cwd: "."