|
|
# yohobuy-mobile
|
|
|
---
|
|
|
|
|
|
|
|
|
## 开发环境部署:
|
|
|
1. 安装node,执行npm install
|
|
|
2. 安装spm,执行spm install
|
|
|
3. gulp启动服务,浏览器访问localhost:5000
|
|
|
|
|
|
|
|
|
Tip: 使用gulp build可以启动spm build服务编译好的文件存入/dist/all.js(or all-debug.js);compass在服务启动时会自动执行编译并监听文件变化。
|
|
|
|
|
|
|
|
|
## to 想调前端代码的后端开发者
|
|
|
|
|
|
### 安装nodejs
|
|
|
|
|
|
[https://nodejs.org/](https://nodejs.org/)
|
|
|
|
|
|
> **注意:** 如果是mac系统记得sudo
|
|
|
|
|
|
### 安装spm
|
|
|
|
|
|
```
|
|
|
npm install -g spm
|
|
|
```
|
|
|
|
|
|
### 安装ruby
|
|
|
|
|
|
如果是mac可以略过,这个已经存在。
|
|
|
windows用户点击这里[http://rubyinstaller.org/](http://rubyinstaller.org/)
|
|
|
|
|
|
### 设置rubygem国内源
|
|
|
|
|
|
```
|
|
|
gem sources --remove https://rubygems.org/
|
|
|
gem sources -a https://ruby.taobao.org/
|
|
|
gem sources -l
|
|
|
|
|
|
```
|
|
|
### 安装compass
|
|
|
|
|
|
```
|
|
|
gem install compass
|
|
|
```
|
|
|
|
|
|
### 初始化项目
|
|
|
|
|
|
```
|
|
|
git clone http://git.dev.yoho.cn/web/yohobuy-frontend.git
|
|
|
cd yoho-frontend/mobile
|
|
|
npm install
|
|
|
spm install
|
|
|
spm doc|comapss watch
|
|
|
```
|
|
|
|
|
|
### 打开本地的JS和css
|
|
|
```
|
|
|
http://localhost:8000/examples/index.html
|
|
|
```
|
|
|
|
|
|
### js,css调用方式
|
|
|
|
|
|
## 引用方式
|
|
|
|
|
|
### seajs的路径
|
|
|
|
|
|
````html
|
|
|
<script src="http://localhost:8000/static/js/sea.js?nowrap"></script>
|
|
|
````
|
|
|
|
|
|
### 配置样式表的路径
|
|
|
````
|
|
|
<link rel="stylesheet" type="text/css" href="http://localhost:8000/public/css/index.css">
|
|
|
````
|
|
|
|
|
|
### 配置seajs
|
|
|
|
|
|
````javascript
|
|
|
seajs.config({
|
|
|
base: "/" //seajs加载器的js基础路径
|
|
|
});
|
|
|
````
|
|
|
### 界面调用
|
|
|
|
|
|
````javascript
|
|
|
var yohobuyMobile = seajs.use('index');
|
|
|
````
|
|
|
|
|
|
or
|
|
|
````javascript
|
|
|
var yohobuyMobile = require('index');
|
|
|
```` |
...
|
...
|
|