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

Fixed indentation

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