简体   繁体   English

主题煎茶触摸 - 需要指南针和 SSAS?

[英]Theming Sencha Touch - Compass & SSAS Required?

I'm pretty new to Sencha Touch.我对 Sencha Touch 很陌生。 From what I've played with, it's a great framework.从我玩过的来看,这是一个很棒的框架。 I'm working on my first production site and I'm having some issues wrapping my mind around the theming.我正在我的第一个生产网站上工作,但我遇到了一些关于主题的问题。 Are Compass & SSAS really required to change the colors of the theme? Compass & SSAS 真的需要更改主题的 colors 吗? It seems ludicrous to me that a simple color change would require so much work.对我来说,一个简单的颜色变化需要这么多工作,这似乎很荒谬。

I've read this tutorial , as well as some others.我已经阅读了本教程以及其他一些教程。 Am I missing something?我错过了什么吗?

You can ofcourse go and modify the CSS and replace all the colors you need, since Compass/SASS just compile to CSS. You can ofcourse go and modify the CSS and replace all the colors you need, since Compass/SASS just compile to CSS. I would have to disagree with you though on that it's ludicrous.我不得不不同意你的观点,尽管这很荒谬。 The base theme color is used in many different places and there are various gradient rules applied to it that Compass/SASS generates.基本主题颜色用于许多不同的地方,并且 Compass/SASS 生成的应用了各种渐变规则。 Quite frankly it's very simple to only change it in one line in your sass file, run "compass compile" and be on your way versus digging through CSS find/replacing and then minifying it for production.坦率地说,仅在 sass 文件中的一行中更改它非常简单,运行“指南针编译”并继续前进,而不是挖掘 CSS 查找/替换然后将其缩小以进行生产。

You should really look at Saas and Compass, nevertheless you will always have to override some css by hand because not all variables are yet defined in Sencha Touch.你真的应该看看 Saas 和 Compass,但是你总是不得不手动覆盖一些 css,因为并不是所有的变量都在 Sencha Touch 中定义。 So some colors and other properties cannot be changed by modifying Sencha sass variables.所以有些colors等属性不能通过修改Sencha sass变量来改变。

Anyway you should use sass so that your custom css code is located in your app.scss file and this will be compiled to the app.css.无论如何,您应该使用 sass 以便您的自定义 css 代码位于您的 app.scss 文件中,这将被编译为 app.css。 So you do not need to add any other.css file in your app structure.所以你不需要在你的应用结构中添加任何其他的.css 文件。

And then you can add your own var to easily customize your own look.然后您可以添加自己的 var 以轻松自定义您自己的外观。

To use compass and saas here is what you should do在这里使用指南针和 saas 是你应该做的

First you need to install ruby (use RubyInstaller )首先你需要安装 ruby (使用RubyInstaller

then install rubygems ( Rubygems )然后安装 rubygems ( Rubygems )

then install compass (gem install compass --pre )然后安装指南针(gem install compass --pre)

then open your application *.scss file (should be in resources/sass/) and change some sencha variables.然后打开您的应用程序 *.scss 文件(应该在 resources/sass/ 中)并更改一些 sencha 变量。 Then run compass compile in your resources/sass/ dir.然后在你的 resources/sass/ 目录中运行 compass compile。

Then relaunch your app.然后重新启动您的应用程序。 It is that easy !就是这么容易!

For more detail check this article I wrote not long ago: sass-for-sencha-touch-2-windows-7有关更多详细信息,请查看我不久前写的这篇文章: sass-for-sencha-touch-2-windows-7

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM