使用 SASS 3.1.7 及之前版本编译 .CSS 文件时出现语法错误
sass .CSS 编译在一台机器上失败,但在另一台机器上工作。在两个 w/Bundler 上使用 Sass gem 版本 3.1.7。
如果我在两台机器上执行 bundle show sass
,它们将具有相同的输出。似乎无法追查这件事的根源是什么。我尝试转储 Gemfile.lock,并从头开始运行 bundle install
- 没有成功 - 相同的错误消息。尝试锁定到 gem 的某些早期版本(特别是 3.1.6 和 3.1.5) - 症状没有变化。
不是 100% 确定我之前使用的是 gem 的哪个版本,但我从 8 月中旬开始才使用 Sass,并且之前从未锁定到某个版本,所以我想我应该尝试锁定到之前的两个版本版本,这两个版本都是在我开始使用 Sass 之前发布的。
$ bundle show sass
/Users/[username]/.rvm/gems/ree-1.8.7-2011.03/gems/sass-3.1.7
编译后的.CSS文件中的错误是:
Syntax error: Invalid property: ":background-image= image_url("public-fade-bg.png")".
on line 5 of [/path/to/application]/app/stylesheets/public_admin.sass
1: // Styles for public views - authentication controller
2: @import application.sass
3:
4: body
5: :background-image= image_url("public-fade-bg.png")
6: #environment
7: :position absolute
8: :background-color= !development_color
9: :font-size 18px
10: :padding 0 5px
sass .CSS compilation fails on one machine, but works on the other. Using Sass gem version 3.1.7 on both w/Bundler.
If I do bundle show sass
on both machines, they have identical output. Can't seem to track down what is at the root of this. I tried dumping my Gemfile.lock, and running bundle install
from scratch - no go - same error message. Tried locking to some previous versions of the gem (3.1.6 and 3.1.5 specifically) - no change in symptoms.
Not 100% sure what version of the gem I was using previously, but I've only been using Sass since mid-August, and it was never locked down to a version before, so I figured I'd try locking to the two previous versions, both of which were released before I began using Sass.
$ bundle show sass
/Users/[username]/.rvm/gems/ree-1.8.7-2011.03/gems/sass-3.1.7
And the error in the compiled .CSS file is:
Syntax error: Invalid property: ":background-image= image_url("public-fade-bg.png")".
on line 5 of [/path/to/application]/app/stylesheets/public_admin.sass
1: // Styles for public views - authentication controller
2: @import application.sass
3:
4: body
5: :background-image= image_url("public-fade-bg.png")
6: #environment
7: :position absolute
8: :background-color= !development_color
9: :font-size 18px
10: :padding 0 5px
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
与开发人员讨论后解决了这个问题。
总而言之,这个特定应用程序使用的语法在 Sass 的早期版本中受支持,但现在不再支持。我正在使用的宝石之一,在某个地方,其版本发生了变化。
经过几天的斗争后,我基本上只是通过从应用程序中检查
Gemfile
和Gemfile.lock
文件的已知工作副本来回滚我的 gem存储库,然后执行bundle install --deployment
之后,一切都恢复在线,并像此过程开始之前一样工作。
Solved this problem after discussing it with a fellow developer.
The long and short of it is that the syntax this particular app is using was supported in a previous version of Sass, but is no longer. One of the gems I was using, somewhere along the lines, got its version changed.
After fighting with it for a couple of days, I basically just rolled back my gems by checking out a known, working copy of the
Gemfile
andGemfile.lock
files from the application repository, and then did abundle install --deployment
After that, everything came back online, and worked as it did before this process started.