【发布时间】:2017-02-04 11:22:54
【问题描述】:
在我的 Rails 应用程序中,我尝试在部署期间运行 gulp 任务,该任务将 css 文件添加到 public 目录内的目录中。在部署日志中,我看到任务运行成功,但是当我 SSH 进入服务器时,我没有看到该文件。
[2016-09-24T01:35:02+00:00] INFO: Processing execute[create critical css] action run (/srv/www/toaster/releases/20160924013146/deploy/before_migrate.rb line 43)
[2016-09-24T01:35:03+00:00] INFO: execute[create critical css] ran successfully
当我通过 SSH 连接到服务器并将我的用户更改为使用 sudo su deploy 的部署用户,然后运行 gulp 任务时,文件被创建。
我做错了什么?
before_migrate 中的行看起来像这样...
execute 'create critical css' do
user 'deploy'
cwd release_path
command 'gulp criticalCss'
end
我的 gulpfile 中的任务如下所示...
gulp.task('criticalCss', function() {
glob('./public/assets/theme_templates/v3/application-*.css', function(err, matches) {
var full_css = matches[0]
penthouse({
url : 'http://performance-site.s2.fanbread.com/blogs/performance-benchmark',
css : full_css,
width: 375,
height: 667
}, function(err, criticalCss) {
console.log(err)
fs.writeFile('./public/assets/theme_templates/v3/posts_show.css', criticalCss); // Write the contents to a jekyll include
});
});
});
谢谢
【问题讨论】:
标签: javascript ruby-on-rails gulp chef-infra aws-opsworks