【发布时间】:2014-04-14 21:41:41
【问题描述】:
在我所有的更改都被推送到 github 之后,我刚刚将一个项目部署到了 heroku。一切都很好,只是我注意到一些更新的新 CSS 没有通过。 css 文件肯定已提交并推送到 github,所以我知道这不是问题。
在 heroku 应用程序上查看源代码时,我注意到它缺少 head 部分中的大部分 .css 和 .js 文件。 Heroku上的头部与我本地的头部不同是否有原因。一切运行顺利,自从我上次推送到 heroku 后,我没有更改任何配置文件......
谢谢。
这里是github项目的链接:https://github.com/michaelnavarro/careerfoundry
application.js:
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery_ujs
//= require bootstrap
//= require turbolinks
//= require_tree .
应用程序.css
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the top of the
* compiled file, but it's generally better to create a new file per style scope.
*= require_self
*= require_tree .
*/
/*
*/
【问题讨论】:
-
是的,它和这个原因被称为资产管道。在生产环境中,所有 JavaScript 和 CSS 文件都应该被压缩并包含在
application.js和application.css文件中(默认情况下)。 -
@MarekLipka 这似乎是以前自动发生的?这是否意味着我需要添加在上次提交到应用程序 .css 文件之前添加的新 .css 文件?因为据我所知,没有其他 css 文件被直接调用到 applicaiton.css 文件中
-
@MarekLipka 据我所知,资产/样式表树中包含的所有内容都会自动添加到 application.css
-
通常通过
//= require_tree .(*= require_tree .for css) 指令自动包含新的 css/js 文件。请显示您的布局代码(即您如何在开发模式下包含这些文件)。 -
这里是github项目的链接:github.com/michaelnavarro/careerfoundry
标签: ruby-on-rails git heroku