有没有办法将 960 和指南针与 sproutcore 一起使用?

发布于 2024-11-10 08:46:25 字数 105 浏览 0 评论 0原文

有办法做到这一点吗?我知道 Compass 可以在 sproutcore 中使用,但我也想使用 960 compass 插件。我尝试在 app.css 中导入“960/grid”,但它一直抛出错误

Is there a way to do this? I know Compass can be used in sproutcore, but i also want to use the 960 compass plugin. I tried dong import "960/grid" in my app.css but it keeps throwing an error

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

櫻之舞 2024-11-17 08:46:25

嗯,有一种方法可以工作,但我不确定是否有更干净的解决方案。我只是使用 sproutcore 1.6 和车把模板设置了一个测试项目

 # sc-init MyTest --template

,并在 apps/MyTest/resources/stylesheets 中添加了一个附加的“test_960.scss”文件,其中包含以下内容

 @import "960/grid";

 $ninesixty_columns: 16;

 #wrapper {
      @include grid_container;
      background-color: red;
 }

但是,这不起作用,因为 sc -服务器无法检测到 960 指南针插件。如果您使用 -v 标志运行 sc-server 来获取调试输出,您可以轻松发现这一点。您会发现这样的异常

 Sass::SyntaxError: File to import not found or unreadable: 960/grid.
 Load paths:
      /Users/myuser/.rvm/gems/ruby-1.9.2-p180/gems/compass 0.11.3/frameworks/blueprint/stylesheets
      /Users/myuser/.rvm/gems/ruby-1.9.2-p180/gems/compass-0.11.3/frameworks/compass/stylesheets
      Compass::SpriteImporter
      [...]

问题是,960 指南针插件未安装在 gems/compass 0.11.3/frameworks 中,而是安装在gems/compass-960-plugin- 中0.10.3。您可以做的是在框架目录中创建一个符号链接,例如

 # cd gems/compass 0.11.3/frameworks
 # ln -s ../../compass-960-plugin-0.10.3 960

停止并重新启动 sc-server,上面的示例将立即运行。

我不知道这对其他基于指南针的应用程序是否有任何不良影响。如前所述,它适用于 sproutcore,但我没有时间进一步测试它。这也适用于其他插件。此外,我没有测试当您构建最终应用程序时这是否也可以正确编译。

Well, there is a way it works but I'm not sure if there is a cleaner solution. I just setup a test-project with sproutcore 1.6 and handlebar templates

 # sc-init MyTest --template

and added an additional "test_960.scss" file in apps/MyTest/resources/stylesheets with the following content

 @import "960/grid";

 $ninesixty_columns: 16;

 #wrapper {
      @include grid_container;
      background-color: red;
 }

However, this does not work since sc-server isn't able to detect the 960 compass plugin. You can easily spot this if you are running sc-server with the -v flag to get the debug output. You'll find an exception like this

 Sass::SyntaxError: File to import not found or unreadable: 960/grid.
 Load paths:
      /Users/myuser/.rvm/gems/ruby-1.9.2-p180/gems/compass 0.11.3/frameworks/blueprint/stylesheets
      /Users/myuser/.rvm/gems/ruby-1.9.2-p180/gems/compass-0.11.3/frameworks/compass/stylesheets
      Compass::SpriteImporter
      [...]

The problem is, that the 960 compass plugin isn't installed within gems/compass 0.11.3/frameworks but in gems/compass-960-plugin-0.10.3. What you can do so, is create a symlink into the framework directory, like that

 # cd gems/compass 0.11.3/frameworks
 # ln -s ../../compass-960-plugin-0.10.3 960

Stop and restart sc-server and the above example will run now.

I don't know if this has any bad implications on other compass based applications. As said, it works for sproutcore but I had not the time to test it further. This also works with other plugins. Moreover, I did not test if this does also compile correctly when you build your final application.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文