Commit 6e0101c7 authored by Vadym Gidulian's avatar Vadym Gidulian

Fixed indentation

parent 1f780f3e
...@@ -24,142 +24,142 @@ function isStaging() { ...@@ -24,142 +24,142 @@ function isStaging() {
return gutil.env.env === 'staging'; return gutil.env.env === 'staging';
} }
function isProduction() { function isProduction() {
return gutil.env.env === 'production'; return gutil.env.env === 'production';
} }
function shallow(done) { function shallow(done) {
return function (error) { return function (error) {
done(error); done(error);
}; };
} }
var paths = new function() { var paths = new function() {
this.srcDir = 'src'; this.srcDir = 'src';
this.distDir = 'dist'; this.distDir = 'dist';
// Files to be copied to `distDir` // Files to be copied to `distDir`
this.files = [ this.files = [
// this.srcDir + '/folder/**/*' // Copy whole folder with subfolders // this.srcDir + '/folder/**/*' // Copy whole folder with subfolders
// this.srcDir + '/file.txt' // Copy specified file // this.srcDir + '/file.txt' // Copy specified file
]; ];
this.cssDir = this.srcDir + '/css'; this.cssDir = this.srcDir + '/css';
this.cssFiles = this.cssDir + '/**/*.css'; this.cssFiles = this.cssDir + '/**/*.css';
this.htmlDir = this.srcDir; this.htmlDir = this.srcDir;
this.html = this.htmlDir + '/**/*.html'; this.html = this.htmlDir + '/**/*.html';
this.htmlFiles = this.html; this.htmlFiles = this.html;
this.htmlOut = this.distDir; this.htmlOut = this.distDir;
this.imgDir = this.srcDir + '/img'; this.imgDir = this.srcDir + '/img';
this.imgFiles = this.imgDir + '/**/*'; this.imgFiles = this.imgDir + '/**/*';
this.imgOut = this.distDir + '/img'; this.imgOut = this.distDir + '/img';
this.jsDir = this.srcDir + '/js'; this.jsDir = this.srcDir + '/js';
this.js = this.jsDir + '/index.js'; this.js = this.jsDir + '/index.js';
this.jsFiles = this.jsDir + '/**/*.js'; this.jsFiles = this.jsDir + '/**/*.js';
this.jsOut = this.distDir + '/js'; this.jsOut = this.distDir + '/js';
this.lessDir = this.srcDir + '/less'; this.lessDir = this.srcDir + '/less';
this.less = this.lessDir + '/index.less'; this.less = this.lessDir + '/index.less';
this.lessFiles = this.lessDir + '/**/*.less'; this.lessFiles = this.lessDir + '/**/*.less';
this.lessOut = this.distDir + '/css'; this.lessOut = this.distDir + '/css';
this.pugDir = this.srcDir + '/pug'; this.pugDir = this.srcDir + '/pug';
this.pug = [ this.pug = [
this.pugDir + '/**/*.pug', this.pugDir + '/**/*.pug',
'!' + this.pugDir + '/includes/**/*' '!' + this.pugDir + '/includes/**/*'
]; ];
this.pugFiles = this.pugDir + '/**/*'; this.pugFiles = this.pugDir + '/**/*';
this.pugOut = this.distDir; this.pugOut = this.distDir;
}; };
// Files // Files
gulp.task('files-copy', function () { gulp.task('files-copy', function () {
return gulp.src(paths.files, { return gulp.src(paths.files, {
base: paths.srcDir base: paths.srcDir
}) })
.pipe(gulp.dest(paths.distDir)); .pipe(gulp.dest(paths.distDir));
}); });
gulp.task('files', ['files-copy']); gulp.task('files', ['files-copy']);
// Images // Images
gulp.task('img-copy', function () { gulp.task('img-copy', function () {
return gulp.src(paths.imgFiles) return gulp.src(paths.imgFiles)
.pipe(gulp.dest(paths.imgOut)); .pipe(gulp.dest(paths.imgOut));
}); });
gulp.task('images', ['img-copy']); gulp.task('images', ['img-copy']);
// Markup // Markup
gulp.task('html-min', function () { gulp.task('html-min', function () {
return gulp.src(paths.html) return gulp.src(paths.html)
.pipe(isLocal() || isTesting() .pipe(isLocal() || isTesting()
? inject.replace('<!--\\s*?weinre\\s*?-->', '<script async src="http://weinre.dev.gvia.group/target/target-script-min.js"></script>') ? inject.replace('<!--\\s*?weinre\\s*?-->', '<script async src="http://weinre.dev.gvia.group/target/target-script-min.js"></script>')
: gutil.noop()) : gutil.noop())
.pipe(isStaging() .pipe(isStaging()
? inject.replace('<!--\\s*?weinre\\s*?-->', '<script async src="http://weinre.dev.gvia.group/target/target-script-min.js#staging"></script>') ? inject.replace('<!--\\s*?weinre\\s*?-->', '<script async src="http://weinre.dev.gvia.group/target/target-script-min.js#staging"></script>')
: gutil.noop()) : gutil.noop())
.pipe(isProduction() .pipe(isProduction()
? inject.replace('<!--\\s*?weinre\\s*?-->', '') ? inject.replace('<!--\\s*?weinre\\s*?-->', '')
: gutil.noop()) : gutil.noop())
.pipe(htmlMin({ .pipe(htmlMin({
collapseWhitespace: true, collapseWhitespace: true,
conservativeCollapse: true conservativeCollapse: true
})) }))
.pipe(gulp.dest(paths.htmlOut)); .pipe(gulp.dest(paths.htmlOut));
}); });
gulp.task('pug-compile', function () { gulp.task('pug-compile', function () {
return gulp.src(paths.pug) return gulp.src(paths.pug)
.pipe(isLocal() || isTesting() .pipe(isLocal() || isTesting()
? inject.replace('//-?\\s*?weinre', 'script(async src="http://weinre.dev.gvia.group/target/target-script-min.js")') ? inject.replace('//-?\\s*?weinre', 'script(async src="http://weinre.dev.gvia.group/target/target-script-min.js")')
: gutil.noop()) : gutil.noop())
.pipe(isStaging() .pipe(isStaging()
? inject.replace('//-?\\s*?weinre', 'script(async src="http://weinre.dev.gvia.group/target/target-script-min.js#staging")') ? inject.replace('//-?\\s*?weinre', 'script(async src="http://weinre.dev.gvia.group/target/target-script-min.js#staging")')
: gutil.noop()) : gutil.noop())
.pipe(isProduction() .pipe(isProduction()
? inject.replace('//-?\\s*?weinre', '') ? inject.replace('//-?\\s*?weinre', '')
: gutil.noop()) : gutil.noop())
.pipe(pug()) .pipe(pug())
.pipe(gulp.dest(paths.pugOut)); .pipe(gulp.dest(paths.pugOut));
}); });
gulp.task('markup', ['html-min', 'pug-compile']); gulp.task('markup', ['html-min', 'pug-compile']);
// Scripts // Scripts
gulp.task('js-browserify', function (done) { gulp.task('js-browserify', function (done) {
return browserify(paths.js, { return browserify(paths.js, {
debug: isLocal() debug: isLocal()
}) })
.bundle() .bundle()
.pipe(source('script.all.min.js')) .pipe(source('script.all.min.js'))
.pipe(!isLocal() ? streamify(uglify().on(failSafe ? 'error' : 'none', shallow(done))) : gutil.noop()) .pipe(!isLocal() ? streamify(uglify().on(failSafe ? 'error' : 'none', shallow(done))) : gutil.noop())
.pipe(gulp.dest(paths.jsOut)); .pipe(gulp.dest(paths.jsOut));
}); });
gulp.task('scripts', ['js-browserify']); gulp.task('scripts', ['js-browserify']);
// Styles // Styles
gulp.task('less-compile', function (done) { gulp.task('less-compile', function (done) {
return gulp.src(paths.less) return gulp.src(paths.less)
.pipe(less().on(failSafe ? 'error' : 'none', shallow(done))) .pipe(less().on(failSafe ? 'error' : 'none', shallow(done)))
.pipe(!isLocal() ? nano().on(failSafe ? 'error' : 'none', shallow(done)) : gutil.noop()) .pipe(!isLocal() ? nano().on(failSafe ? 'error' : 'none', shallow(done)) : gutil.noop())
.pipe(rename('style.all.min.css')) .pipe(rename('style.all.min.css'))
.pipe(gulp.dest(paths.lessOut)); .pipe(gulp.dest(paths.lessOut));
}); });
gulp.task('styles', ['less-compile']); gulp.task('styles', ['less-compile']);
// Stages // Stages
gulp.task('watch', function () { gulp.task('watch', function () {
failSafe = true; failSafe = true;
gulp.watch(paths.files, ['files']); gulp.watch(paths.files, ['files']);
gulp.watch(paths.imgFiles, ['images']); gulp.watch(paths.imgFiles, ['images']);
gulp.watch([paths.htmlFiles, paths.pugFiles], ['markup']); gulp.watch([paths.htmlFiles, paths.pugFiles], ['markup']);
gulp.watch(paths.jsFiles, ['scripts']); gulp.watch(paths.jsFiles, ['scripts']);
gulp.watch([paths.cssFiles, paths.lessFiles], ['styles']); gulp.watch([paths.cssFiles, paths.lessFiles], ['styles']);
}); });
gulp.task('build', ['files', 'images', 'markup', 'scripts', 'styles']); gulp.task('build', ['files', 'images', 'markup', 'scripts', 'styles']);
......
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>Project</title> <title>Project</title>
<script async src="js/script.all.min.js"></script> <script async src="js/script.all.min.js"></script>
<link rel="stylesheet" href="css/style.all.min.css"> <link rel="stylesheet" href="css/style.all.min.css">
</head> </head>
<body> <body>
<!-- weinre --> <!-- weinre -->
......
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
var $ = require('jquery'); var $ = require('jquery');
module.exports = { module.exports = {
/* /*
* Functions to be exported go here. Format: * Functions to be exported go here. Format:
* exportName: functionName * exportName: functionName
*/ */
}; };
// Code goes here // Code goes here
...@@ -10,6 +10,6 @@ var functions = require('./functions'); ...@@ -10,6 +10,6 @@ var functions = require('./functions');
$(function () { $(function () {
// Code goes here // Code goes here
}); });
mixin head(title) mixin head(title)
head head
meta(charset="UTF-8") meta(charset="UTF-8")
title= title title= title
script(async src="js/script.all.min.js") script(async src="js/script.all.min.js")
link(rel="stylesheet" href="css/style.all.min.css") link(rel="stylesheet" href="css/style.all.min.css")
block block
...@@ -2,8 +2,8 @@ include includes/mixins ...@@ -2,8 +2,8 @@ include includes/mixins
doctype html doctype html
html(lang="en") html(lang="en")
+head('Project') +head('Project')
body body
// weinre // weinre
// Code goes here // Code goes here
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment