Chinaunix首页 | 论坛 | 博客
  • 博客访问: 366786
  • 博文数量: 28
  • 博客积分: 455
  • 博客等级: 下士
  • 技术积分: 445
  • 用 户 组: 普通用户
  • 注册时间: 2010-04-09 11:10
文章分类

全部博文(28)

文章存档

2016年(5)

2014年(1)

2013年(10)

2011年(7)

2010年(5)

我的朋友

分类: Android平台

2013-09-10 11:23:38

一、问题描述

chrome浏览器升级到29版本之后,发现之前的sencha touch 2.2.1应用的界面出了问题:

textfield这些都不见了


四处查找,在官网论坛找到一个文章“Chrome 29 Layout Fix



要求找到sencha touchu sdk目录下的文件
resources/themes/stylesheets/sencha-touch/base/mixins/_Class.scss
把mixin st-box的顺序替换成以下css

  1. @mixin st-box($important: no) {
  2.     @if $important == important {
  3.         display: flex !important;
  4.         display: -webkit-box !important;
  5.         display: -ms-flexbox !important;
  6.     } @else {
  7.         display: flex;
  8.         display: -webkit-box;
  9.         display: -ms-flexbox;
  10.     }
  11. }

然后重新编译css文件,发布即可

这个文件“ _Class.scss” 里的内容倒是找到并修改过来了
但是不知道怎么编译scss文件
于是四处查找文章,终于找到一篇文章,讲得很详细了
How to use SASS with Sencha Touch without Sencha Cmd

整理一下步骤

二、编译步骤

1、installing Ruby
   这一步骤,其实之前在使用sencha cmd打包,新建工程的时候已经安装过了


2、安装sass和compass,gem是安装完Ruby之后的一个命令
  在命令行窗口运行以下2个命令安装

   gem install sass  
   gem install compass
   
 
  我在安装sass的时候,貌似报错了,于是到网上下载gem文件来本地安装

   目前最新版v3.2.10
   
   gem install sass-3.2.10.gem
   gem install compass-0.12.2.gem


3、新建一个文件夹 “styles”,我的文件夹和sencha touch sdk文件夹平行,如下:
   |--sencha-touch-2.2.1
   |--styles 目录
      |--css 目录
      |--sass 目录
         |--sencha-touch.scss 文件(内容见后面)
      |--stylesheets 目录
         |--fonts 目录(等会儿copy过来的)
      |--config.rb 文件(内容见后面)


4、config.rb的内容

点击(此处)折叠或打开

  1. # Get the directory that this configuration file exists in
  2. dir = File.dirname(__FILE__)
  3. # Load the sencha-touch framework automatically.
  4. load File.join(dir, '../', 'sencha-touch-2.2.1', 'resources', 'themes')
  5. # 这里的路径就和config.rb所在的路径有关了,注意修改自己的路径,最终能找到sencha touch sdk路径
  6. # Compass configurations
  7. sass_path = 'sass'
  8. css_path = 'css'
  9. environment = :production
  10. output_style = :compressed
  11. # Alternatively you can use the following code for environment and output_style:
  12. #environment = :development
  13. #output_style = :expanded


5、copy the folder “/themes/fonts” to a new folder called “stylesheets” in the folder “styles”.
把sencha touch sdk下面resources\themes\fonts这个目录复制到stylesheets目录下


6、 sencha-touch.scss的内容
   create file “sencha-touch.scss” in the folder "styles/sass".
   This file is a modified version of the same file in folder: /themes/templates/project/

点击(此处)折叠或打开

  1. @import 'sencha-touch/default';
  2. @import 'sencha-touch/default/all';


  3. // You may remove any of the following modules that you
  4. // do not use in order to create a smaller css file.
  5. @import 'sencha-touch/default/src/Button';
  6. @import 'sencha-touch/default/src/Panel';
  7. @import 'sencha-touch/default/src/Sheet';
  8. @import 'sencha-touch/default/src/Toolbar';
  9. @import 'sencha-touch/default/src/carousel/Carousel';
  10. @import 'sencha-touch/default/src/dataview/IndexBar';
  11. @import 'sencha-touch/default/src/dataview/List';
  12. @import 'sencha-touch/default/src/field/Field';
  13. @import 'sencha-touch/default/src/field/Radio';
  14. @import 'sencha-touch/default/src/field/Search';
  15. @import 'sencha-touch/default/src/field/Select';
  16. @import 'sencha-touch/default/src/field/Slider';
  17. @import 'sencha-touch/default/src/field/Spinner';
  18. @import 'sencha-touch/default/src/field/TextArea';
  19. @import 'sencha-touch/default/src/form/Panel';
  20. @import 'sencha-touch/default/src/form/FieldSet';
  21. @import 'sencha-touch/default/src/picker/Picker';
  22. @import 'sencha-touch/default/src/slider/Slider';
  23. @import 'sencha-touch/default/src/slider/Toggle';
  24. @import 'sencha-touch/default/src/tab/Panel';


7、编译css文件:
打开命令行窗口,到styles目录下,编译之
cd styles
compass compile
最终会生成一个css文件 styles\css\sencha-touch.css
把该文件复制到自己项目文件夹touch\resources\css下,替换原来的文件
发布到网站上去,再次打开chrome29以上,textfield又回来了



阅读(2901) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~