Skip to content

Commit

Permalink
首页和App编译为两个目录
Browse files Browse the repository at this point in the history
  • Loading branch information
amio committed May 29, 2014
1 parent 05cc6a4 commit 8b62e61
Show file tree
Hide file tree
Showing 2 changed files with 182 additions and 12 deletions.
38 changes: 26 additions & 12 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ var $ = require('gulp-load-plugins')();

var LOCAL_PORT = 9999;
var SOURCE_ROOT = './app';
var BUILD_ROOT = './dist';
var BUILD_ROOT = './dist/app';
var INTRO_ROOT = './dist/intro';

/**
* =====================================
Expand Down Expand Up @@ -88,17 +89,24 @@ gulp.task('lint', function () {
* =====================================
*/

//var sass = require('gulp-ruby-sass');
//var jshint = require('gulp-jshint');

gulp.task('usemin', ['html2js'], function () {
gulp.src('./app/*.html')

// WebApp
gulp.src('app/*.html')
.pipe($.usemin({
css: [$.autoprefixer(), $.minifyCss(), $.rev()],
js: [$.ngmin(), $.uglify(), $.rev()],
html: [$.minifyHtml({empty: true})]
}))
.pipe(gulp.dest(BUILD_ROOT));

// Homepage
gulp.src('home/*.html')
.pipe($.usemin({
css: [$.autoprefixer(), $.minifyCss(), $.rev()],
html: [$.minifyHtml({empty: true})]
}))
.pipe(gulp.dest('dist/home'));
});

gulp.task('html2js', function () {
Expand All @@ -115,23 +123,29 @@ gulp.task('html2js', function () {
});

gulp.task('imagemin', function () {
var imgSrc = './app/images/*.*';
var imgDst = './dist/images';
var imgSrc = SOURCE_ROOT + '/images/*.*';
var imgDst = BUILD_ROOT + '/images';

gulp.src(imgSrc)
.pipe($.changed('./dist/images'))
.pipe($.changed(imgDst))
.pipe($.imagemin())
.pipe(gulp.dest(imgDst));
});

gulp.task('copy', function () {

// WebApp
gulp.src([
'!' + SOURCE_ROOT + '/*.html',
SOURCE_ROOT + '/*.*',
SOURCE_ROOT + '/scripts/assets/*.*',
SOURCE_ROOT + '/fonts/**/*'
], { base: SOURCE_ROOT })
.pipe(gulp.dest(BUILD_ROOT));

// Homepage
gulp.src(['app/fonts/**/*'])
.pipe(gulp.dest('dist/home/fonts'));
});

gulp.task('clean', function () {
Expand Down Expand Up @@ -164,18 +178,18 @@ function sh(commands) {

function distribution(tar) {
var targets = {
open: '[email protected]:/var/www/ProtoShop/html/',
io: '[email protected]:/var/www/ProtoShop/html/',
ctqa: '[email protected]:/var/www/ProtoShop/html/',
debug: '[email protected]:/var/www/Debug/html/'
};
var rsyncParams = ' -avz -e ssh --delete --exclude=.git* --exclude=*.scss --exclude=node_modules';
var command = 'rsync ' + BUILD_ROOT + '/ ' + targets[tar] + rsyncParams;
var command = 'rsync ./dist/ ' + targets[tar] + rsyncParams;

sh(command);
}

gulp.task('dist:open', function () {
distribution('open');
gulp.task('dist:io', function () {
distribution('io');
});

gulp.task('dist:ctqa', function () {
Expand Down
156 changes: 156 additions & 0 deletions home/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>Protoshop</title>
<!-- build:css styles/intro.css -->
<link rel="stylesheet" href="../app/styles/intro.css" />
<link rel="stylesheet" href="../app/styles/font-awesome.css" />
<!-- endbuild -->
</head>
<body>
<div id="splash" class="row splash">
<div class="logo"></div>
<div class="splash-show">
<div class="show-desktop"><span class="fa fa-desktop"></span><br />Build on Web</div>
<span class="fa fa-angle-right"></span>
<div class="show-mobile"><span class="fa fa-mobile"></span><br />View on Mobile</div>
</div>
<div class="nav">
<div class="nav-slide">
<span>Protoshop</span>
<a id="gotry" href="#tryonline">Online Editor</a>
<a id="gomob" href="#getmobile">Mobile Client</a>
<a id="goabt" href="#about">About</a>
</div>
<div class="nav-login">
<a href="../app/">Login</a>
</div>
</div>
</div>
<div id="tryonline" class="row tryonline">
<div class="online">
<h3><em>Build</em>On Web</h3>
<div class="pic-online"></div>
</div>
</div>
<div id="getmobile" class="row getmobile">
<div class="mobile">
<h3><em>View</em>On Mobile</h3>
<div class="pic-mobile"></div>
</div>
</div>
<div id="about" class="row about">
<ul class="team-member">
<li>
<div class="person-avatar"></div>
<div class="person-info">
<div class="person-name">Wei He</div>
<div class="person-job">CtripWXD Director</div>
<i class="fa fa-weibo"></i> <a href="http://weibo.com/hewei1976" target="_blank">weihe可以懂</a>
</div>
</li>
<li>
<div class="person-avatar"></div>
<div class="person-info">
<div class="person-name">Lei Kuo</div>
<div class="person-job">Project Manager / Team Leader</div>
</div>
</li>
<li>
<div class="person-avatar"></div>
<div class="person-info">
<div class="person-name">Amio</div>
<div class="person-job">JS Developer</div>
<i class="fa fa-weibo"></i> <a href="http://weibo.com/amio" target="_blank">烟波湛狂蓝</a>
</div>
</li>
<li>
<div class="person-avatar"></div>
<div class="person-info">
<div class="person-name">Lily Xue</div>
<div class="person-job">HTML/CSS Developer / UX / UI</div>
<i class="fa fa-weibo"></i> <a href="http://weibo.com/lilyxue" target="_blank">点头猪</a>
</div>
</li>
<li>
<div class="person-avatar"></div>
<div class="person-info">
<div class="person-name">Anselz</div>
<div class="person-job">Server Developer</div>
<i class="fa fa-weibo"></i> <a href="http://weibo.com/517433742" target="_blank" target="_blank">Janselz</a>
</div>
</li>
<li>
<div class="person-avatar"></div>
<div class="person-info">
<div class="person-name">Hongli Yu</div>
<div class="person-job">iOS Developer</div>
</div>
</li>
<li>
<div class="person-avatar"></div>
<div class="person-info">
<div class="person-name">Xinke Li</div>
<div class="person-job">Android Developer</div>
</div>
</li>
</ul>
<dl class="team-nonmember">
<dt>Credits:</dt>
<dd>
<span class="person-name">Yanghe Liu</span>
<a href="http://weibo.com/mewjerry" title="不编程不舒服斯基" class="fa fa-weibo" target="_blank"></a>
</dd>
<dd>
<span class="person-name">Flea</span>
<a href="http://weibo.com/catflea" title="iflea" class="fa fa-weibo" target="_blank"></a>
</dd>
<dd>
<span class="person-name">Xianqin Zhu</span>
<a href="http://weibo.com/u/1867165890" title="happy奔向未来" class="fa fa-weibo" target="_blank"></a>
</dd>
</dl>
<div class="donate">
<i class="fa fa-coffee"></i> <a href="https://qr.alipay.com/ap27zqsxo3v5q61z1f" title="求咖灰~~~" target="_blank">Buy me a coffee!</a> (੭ु๑‾᷄ ⁻̫ ‾᷅)੭ु⁾⁾
</div>
</div>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script>
$(function(){
var $win = $(window), $nav = $('.nav');
var barHeight = 40;
$win.on('scroll',function(e){
if ($win.scrollTop() > $win.height() - barHeight){
$nav.addClass('fixed');
}else{
$nav.removeClass('fixed');
}
});

$('.nav span').on('click',function($e){
scrollTo('#splash');
$e.preventDefault();
});
$('#gotry, .from').on('click',function($e){
scrollTo('#tryonline');
$e.preventDefault();
});
$('#gomob, .to').on('click',function($e){
scrollTo('#getmobile');
$e.preventDefault();
});
$('#goabt').on('click',function($e){
scrollTo('#about');
$e.preventDefault();
});

function scrollTo (elem){
$('html, body').animate({
scrollTop: $(elem).offset().top
}, 160);
}
});
</script>
</body>
</html>

0 comments on commit 8b62e61

Please sign in to comment.