Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Borodin committed Nov 3, 2015
0 parents commit 3a2118f
Show file tree
Hide file tree
Showing 27 changed files with 540 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules/
bower_components/
src/lib/
build/**/*.map
Thumbs.db
npm-debug.log
.ftppass
29 changes: 29 additions & 0 deletions .jscsrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"preset": "google",
"fileExtensions": [".js", "jscs"],

"requireSemicolons": true,
"requireParenthesesAroundIIFE": true,
"maximumLineLength": 120,
"validateIndentation": 4,
"disallowTrailingComma": true,
"disallowUnusedParams": true,

"disallowSpacesInsideObjectBrackets": null,
"disallowImplicitTypeConversion": ["string"],

"safeContextKeyword": "_this",

"jsDoc": {
"checkAnnotations": "closurecompiler",
"checkParamNames": true,
"requireParamTypes": true,
"checkRedundantParams": true,
"checkReturnTypes": true,
"checkRedundantReturns": true,
"requireReturnTypes": true,
"checkTypes": "capitalizedNativeCase",
"checkRedundantAccess": true,
"requireNewlineAfterDescription": true
}
}
14 changes: 14 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"browser": true,
"node": true,

"camelcase": true,
"strict": false,
"latedef": true,
"maxlen": 120,
"quotmark": "single",
"undef": true,
"unused": true,

"eqnull": true
}
49 changes: 49 additions & 0 deletions .stylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"blocks": false,
"brackets": {
"expect": "never",
"error": "true"
},
"colons": {
"expect": "never",
"error": "true"
},
"colors": false,
"commaSpace": {
"expect": "always",
"error": "true"
},
"commentSpace": {
"expect": "always",
"error": "true"
},
"cssLiteral" : false,
"depthLimit": false,
"duplicates": true,
"efficient": false,
"extendPref": false,
"globalDupe": false,
"indentPref": false,
"leadingZero": false,
"none": false,
"noImportant": true,
"placeholders": false,
"prefixVarsWithDollar": {
"expect": "always",
"error": "true"
},
"semicolons": {
"expect": "never",
"error": true
},
"sortOrder": false,
"stackedProperties": {
"expect": "never",
"error": true
},
"valid": true,
"zeroUnits": {
"expect": "never",
"error": "true"
}
}
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
tour-player
===========

#### Getting started
```git clone https://github.com/Tour-360/tour-player.git && cd tour-player```

```npm install -g gulp bower ```

```npm install ```

#### Build
```gulp ```

#### Run server (browserSync)
```gulp serve ```

#### FTP Deploy
```gulp deploy```
6 changes: 6 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "tour-player",
"dependencies": {
"threejs": "latest"
}
}
1 change: 1 addition & 0 deletions build/badbrowser.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!DOCTYPE html><head><meta charset=UTF-8><title>Слишком старый браузер</title></head><body><h3>Для отображения виртуального тура необходимо обновить браузер.</h3><a id=download target=_blank>Обновить</a></body>
2 changes: 2 additions & 0 deletions build/css/main.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added build/fonts/opensans-regular.woff2
Binary file not shown.
15 changes: 15 additions & 0 deletions build/js/main.js

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions example/data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name": "Test"
}
11 changes: 11 additions & 0 deletions example/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!doctype html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<link rel="stylesheet" href="../build/css/main.css">
<script src="../build/js/main.js"></script><!-- async -->
<title></title>
</head>
<body>
</body>
</html>
149 changes: 149 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
'use strict';

var gulp = require('gulp');
var del = require('del');
var autoprefixer = require('gulp-autoprefixer');
var cache = require('gulp-cache');
var concat = require('gulp-concat');
var imagemin = require('gulp-imagemin');
var jscs = require('gulp-jscs');
var jshint = require('gulp-jshint');
var minifyHTML = require('gulp-minify-html');
var size = require('gulp-size');
var sourcemaps = require('gulp-sourcemaps');
var sftp = require('gulp-sftp');
var stylint = require('gulp-stylint');
var stylus = require('gulp-stylus');
var uglify = require('gulp-uglify');
var mainBowerFiles = require('main-bower-files');

var browserSync = require('browser-sync').create();

// Удаляет все содержимое папки build и src/lib
gulp.task('clean', function() {
return del.sync(['build/**', 'src/lib/**']);
});

// Очищает кэш файлов
gulp.task('clear', function(done) {
return cache.clearAll(done);
});

// Конкатинирует и минифицирует JavaScript, создает sourseMap
gulp.task('scripts', function() {
return gulp.src(['src/js/**/*.js', 'src/lib/**/*.js'])
.pipe(sourcemaps.init())
.pipe(concat('main.js'))
.pipe(uglify({
preserveComments: 'some',
outSourceMap: true
}))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('build/js'))
.pipe(size({title: 'scripts'}));
});

// Конкатинирует и минифицирует CSS, STYLUS, создает sourseMap
gulp.task('styles', function() {
return gulp.src(['src/css/main.styl'])
.pipe(sourcemaps.init())
.pipe(stylus({compress: true}))
.pipe(autoprefixer({browsers: ['last 5 versions']}))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('build/css'))
.pipe(size({title: 'styles'}));
});

// Копирует шрифты
gulp.task('fonts', function() {
return gulp.src(['src/fonts/**'])
.pipe(gulp.dest('build/fonts'))
.pipe(size({title: 'fonts'}));
});

// Сжимает изображения (gif, jpg, png, svg) без потерь
gulp.task('images', function() {
return gulp.src(['src/img/**/*'])
.pipe(cache(imagemin({
progressive: true,
interlaced: true
})))
.pipe(gulp.dest('build/img'))
.pipe(size({title: 'images'}));
});

// Копирует и минифицирует все html страницы
gulp.task('html', function() {
return gulp.src(['src/*.html'])
.pipe(minifyHTML())
.pipe(gulp.dest('build'))
.pipe(size({title: 'html'}));
});

// Копирует все файлы из корня, кроме html
gulp.task('copy', function() {
return gulp.src(['src/*', '!src/*.html'])
.pipe(gulp.dest('build'))
.pipe(size({title: 'copy'}));
});

//Копирует главные файлы из bower_components/ в src/lib/
gulp.task('mainBowerFiles', function() {
return gulp.src(mainBowerFiles())
.pipe(gulp.dest('src/lib'));
});

// Проверка всех JS файлов в папке src/js
gulp.task('jslint', function() {
return gulp.src('src/js/**/*.js')
.pipe(jshint())
.pipe(jshint.reporter('default', { verbose: true }));
});

// Проверка стиля javascript
gulp.task('jscs', function() {
return gulp.src('src/js/**/*.js')
.pipe(jscs())
.pipe(jscs.reporter());
});

// Проверка всех stylus файлов в папке src/css
gulp.task('stylint', function() {
return gulp.src('src/css/**/*.styl')
.pipe(stylint())
.pipe(stylint.reporter())
.pipe(stylint.reporter('fail'));
});

// Запускает локальный http сервер, следит за изменениями
gulp.task('serve', ['build'], function() {
browserSync.init({
notify: false,
server: './',
startPath: '/example/'
});

gulp.watch(['example/*'], [browserSync.reload]);
gulp.watch(['src/*.html'], ['html', browserSync.reload]);
gulp.watch(['src/*', '!src/*.html'], ['copy', browserSync.reload]);
gulp.watch(['src/js/**/*.js', 'src/lib/*.js'], ['scripts', browserSync.reload]);
gulp.watch(['src/css/**/*.{css,styl}', 'src/lib/*.css'], ['styles', browserSync.reload]);
gulp.watch(['src/fonts/**'], ['fonts', browserSync.reload]);
gulp.watch(['src/img/**/*'], ['images', browserSync.reload]);
});

//Публикация на сайте tour-360.ru по FTP
gulp.task('deploy', function() {
return gulp.src(['build/**/*', '!build/**/*.map'])
.pipe(sftp({
host: 'tour-360.ru',
auth: 'admin',
remotePath: 'public_html/tour-player/v2.0'
}));
});

gulp.task('lint', ['jslint', 'jscs','stylint']);
gulp.task('build', ['clean', 'clear', 'mainBowerFiles'], function() {
gulp.run(['copy', 'html', 'images', 'fonts', 'scripts', 'styles']);
});
gulp.task('default', ['build']);
54 changes: 54 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"name": "tour-player",
"version": "0.6.0",
"description": "",
"repository": {},
"scripts": {
"postinstall": "bower i && gulp build && gulp serve"
},
"repository": {
"type": "git",
"url": "https://github.com/Tour-360/tour-player"
},
"keywords": [
"tour",
"virtual",
"player",
"360",
"HTML5",
"raw"
],
"author": "Maxim Borodin <[email protected]> (http://maximborodin.ru)",
"contributors": [
{
"name" : "Maxim Borodin",
"email" : "[email protected]",
"url" : "http://maximborodin.ru"
},{
"name" : "Denis Borodin",
"email" : "[email protected]",
"url" : "http://denisborodin.ru"
}
],
"license": "MIT",
"devDependencies": {
"bower": "^1.5.3",
"browser-sync": "^2.9.0",
"del": "^2.0.2",
"gulp": "^3.9.0",
"gulp-autoprefixer": "^3.0.2",
"gulp-cache": "^0.3.0",
"gulp-concat": "^2.6.0",
"gulp-imagemin": "^2.3.0",
"gulp-jscs": "^3.0.1",
"gulp-jshint": "^1.11.2",
"gulp-minify-html": "^1.0.4",
"gulp-sftp": "^0.1.5",
"gulp-size": "^1.0.0",
"gulp-sourcemaps": "^1.5.2",
"gulp-stylint": "^3.0.0",
"gulp-stylus": "^2.1.0",
"gulp-uglify": "^1.4.1",
"main-bower-files": "^2.9.0"
}
}
10 changes: 10 additions & 0 deletions src/badbrowser.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<head>
<meta charset="UTF-8">
<title>Слишком старый браузер</title>
</head>
<body>
<h3>Для отображения виртуального тура необходимо обновить браузер.</h3>
<a href="" id="download" target="_blank">Обновить</a>
</body>
</html>
3 changes: 3 additions & 0 deletions src/css/layout.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
body, html
margin 0
padding 0
2 changes: 2 additions & 0 deletions src/css/main.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@import "variables/*.styl"
@import "layout.styl"
Empty file added src/css/variables/color.styl
Empty file.
Binary file added src/fonts/opensans-regular.woff2
Binary file not shown.
Loading

0 comments on commit 3a2118f

Please sign in to comment.