Authored by 2586703@qq.com

home-page init

*.iml
.idea/
.ipr
.iws
*~
~*
*.diff
*.patch
*.bak
.DS_Store
Thumbs.db
.project
.*proj
.svn/
*.swp
*.swo
*.pyc
*.pyo
.build
node_modules
_site
sea-modules
spm_modules
.cache
dist
coverage
.sass-cache
public/css
... ...
dist
_site
sea-modules
spm_modules
node_modules
.git
tests
examples
test
coverage
... ...
/**
* Node服务端入口文件
* @author: xuqi(qi.xu@yoho.cn)
* @date: 2015/3/27
*/
var express = require('express'),
path = require('path'),
hbs = require('hbs'),
bodyParser = require('body-parser'),
app = express();
//configuration
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'html');
app.engine('html', require('hbs').__express);
hbs.registerPartials(__dirname + '/views/partials');
//middleware
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: false}));
app.use(express.static(path.join(__dirname, '/public')));
//router
require('./router')(app);
//server
app.listen(5000, function() {
console.log('server start');
});
module.exports = app;
\ No newline at end of file
... ...
require 'compass/import-once/activate'
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "public/css"
sass_dir = "public/sass"
images_dir = "public/img"
javascripts_dir = "public/js"
fonts_dir = "public/fonts"
# You can select your preferred output style here (can be overridden via the command line):
# output_style = :expanded or :nested or :compact or :compressed
# To enable relative paths to assets via compass helper functions. Uncomment:
# relative_assets = true
# To disable debugging comments that display the original location of your selectors. Uncomment:
# line_comments = false
# If you prefer the indented syntax, you might want to regenerate this
# project again passing --syntax sass, or you can uncomment this:
# preferred_syntax = :sass
# and then run:
# sass-convert -R --from scss --to sass sass scss && rm -rf sass && mv scss sass
... ...
/**
* GULP ENTRY
* author: xuqi(qi.xu@yoho.cn)
* date: 2015/6/29
*/
var gulp = require('gulp'),
compass = require('gulp-compass'),
server = require('gulp-develop-server');
gulp.task('default', ['server', 'server:restart', 'compass-watch', 'compass']);
// start express server
gulp.task('server', function() {
server.listen({
path: 'app.js'
});
});
// restart server if app.js changed
gulp.task('server:restart', function() {
gulp.watch(['app.js', 'views/controller/*.js', 'public/js/data.js'], server.restart);
});
// compass watch
gulp.task('compass-watch', function() {
gulp.watch('public/sass/**/*.scss', ['compass']);
});
//compass
gulp.task('compass', function() {
gulp.src('public/sass/**/*.scss')
.pipe(
compass({
config_file: 'config.rb',
css: 'public/css',
sass: 'public/sass'
})
)
});
\ No newline at end of file
... ...
var yohobuyMobile;
module.exports = yohobuyMobile;
\ No newline at end of file
... ...
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="../css/index.css">
</head>
<body>
{{{body}}}
</body>
</html>
\ No newline at end of file
... ...
{
"name": "homePage",
"version": "1.0.0",
"description": "yohobuy-mobile homePage",
"main": "app.js",
"scripts": {
"test": "spm test",
"build": "spm build"
},
"author": "liuyue <yue.liu@yoho.cn>",
"license": "ISC",
"spm": {
"main": "index.js",
"dependencies": {
"jquery": "1.8.3",
"mlellipsis": "0.0.6",
"lazyload": "1.9.6",
"iscroll": "5.1.2",
"mustache": "2.0.0",
"underscore": "1.6.0"
},
"devDependencies": {
"expect.js": "0.3.1"
},
"buildArgs": "--idleading {{}}"
},
"devDependencies": {
"spm": "3"
},
"dependencies": {
"body-parser": "^1.12.2",
"express": "^4.12.3",
"gulp": "^3.8.11",
"gulp-compass": "^2.0.4",
"gulp-concat": "^2.5.2",
"gulp-develop-server": "^0.4.2",
"gulp-ftp": "^1.0.3",
"gulp-util": "^3.0.4",
"hbs": "^3.0.1"
}
}
\ No newline at end of file
... ...
/**
* 路由处理文件
* @author: liuyue(yue.liu@yoho.cn)
* @date: 2015/7/13
*/
var boys = require('./views/controller/boys');
module.exports = function(app) {
app.get('/boys', boys.index); //boys首页
};
\ No newline at end of file
... ...
/**
* 男首页控制器
* @author: liuyue(yue.liu@yoho.cn)
* @date: 2015/7/13
*/
var data = require('../../public/js/data/boys'),
layoutPath = '../layouts/layout';
// 首页
exports.index = function(req, res) {
res.render('pages/boys', {
data: data,
layout: layoutPath,
module: 'boys'
});
};
\ No newline at end of file
... ...
boys home
\ No newline at end of file
... ...