This repository was archived by the owner on Jan 9, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
executable file
·60 lines (54 loc) · 1.6 KB
/
gulpfile.js
File metadata and controls
executable file
·60 lines (54 loc) · 1.6 KB
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
// Gulp plugins
var gulp = require('gulp'),
$ = require('gulp-load-plugins')();
compass = require('gulp-compass');
browserSync = require('browser-sync'),
reload = browserSync.reload;
// Config
var AUTOPREFIXER_BROWSERS = ['last 2 versions'];
var ASSETS_DIR = './';
var SCSS_DIR = ASSETS_DIR + 'src/styles/';
var STYLES_DIR = ASSETS_DIR + 'styles/';
var JS_DIR = ASSETS_DIR + 'scripts/';
var JS_FILES = [
ASSETS_DIR + 'src/scripts/app.js'
];
// Styles
gulp.task('styles', function() {
return gulp.src(SCSS_DIR + '*.scss')
.pipe($.compass({ compass: true, sourcemap: true, outputStyle: 'nested' }))
.pipe($.autoprefixer({browsers: AUTOPREFIXER_BROWSERS}))
.pipe(gulp.dest(STYLES_DIR));
});
gulp.task('styles', function() {
return gulp.src(SCSS_DIR + '*.scss')
.pipe(compass({
config_file: 'config.rb',
css: STYLES_DIR,
sass: SCSS_DIR,
}))
.pipe(gulp.dest(STYLES_DIR));
});
// Scripts
gulp.task('scripts', function() {
return gulp.src(JS_FILES)
.pipe($.jshint())
.pipe($.jshint.reporter('jshint-stylish'))
.pipe($.if(!browserSync.active, $.jshint.reporter('fail')))
.pipe($.concat('main.js'))
.pipe(gulp.dest(JS_DIR))
.pipe(reload({ stream: true }));
});
gulp.task('serve', ['styles', 'scripts'], function() {
browserSync({
notify: false,
server: {
baseDir: './'
},
https: true,
port: 9999,
});
gulp.watch(SCSS_DIR + '**/*.scss', ['styles', reload]);
gulp.watch(ASSETS_DIR + 'src/scripts/' + '**/*.js', ['scripts']);
gulp.watch('**/*.html', reload);
});