-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
75 lines (68 loc) · 1.94 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/* jshint node: true */
/* jshint -W100 */
'use strict';
var gulp = require("gulp");
var babel = require("gulp-babel");
var browserSync = require('browser-sync');
var concat = require("gulp-concat");
var gutil = require('gulp-util');
var jshint = require('gulp-jshint');
var postcss = require('gulp-postcss');
var notify = require("gulp-notify");
var rename = require('gulp-rename');
var sass = require('gulp-sass');
var sourcemaps = require("gulp-sourcemaps");
var uglify = require('gulp-uglify');
var strip = require('gulp-strip-comments');
var stripCssComments = require('gulp-strip-css-comments');
var config = {
sassPath: './src/scss',
npmDir: './node_modules',
bowerDir: './bower_components'
};
/*-- start copy all image
gulp.task('copy-font-awesome', function() {return gulp.src(config.npmDir + '/font-awesome/fonts/**.*')
.pipe(gulp.dest('./dist/fonts'));
});
-- */
/*-- end copy all js --*/
gulp.task('compile-scss', function () {
gulp.src('src/scss/**/*.scss')
.pipe(sourcemaps.init())
.pipe(sass({includePaths: [
'src/scss'
]}))
.pipe(sass({outputStyle: 'nested'}) )
.on("error", notify.onError(function (error) {
return "Error: " + error.message;
}))
.pipe(postcss([
require('autoprefixer')
]))
.pipe(rename('all.css'))
.pipe(gulp.dest('dist/css'));
});
gulp.task('compile-js', function() {
return gulp.src('src/js/**/*.js')
.pipe(concat('scripts.js'))
.pipe(gulp.dest('dist/js/app_lib'));
});
gulp.task('browser-sync', function() {
browserSync.init(["dist/css/*.css", "dist/js/*.js"], {
server: {
baseDir: "./dist"
}
});
});
gulp.task('default',
[
'compile-scss',
'compile-js',
'browser-sync'
],
function () {
gulp.watch("src/scss/**/*.scss", ['compile-scss']).on('change', browserSync.reload);
gulp.watch("src/js/**/*.js", ['compile-js']).on('change', browserSync.reload);
gulp.watch('dist/**/*.html').on('change', browserSync.reload);
}
);