-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgulpfile.js
More file actions
63 lines (53 loc) · 1.76 KB
/
gulpfile.js
File metadata and controls
63 lines (53 loc) · 1.76 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
61
62
63
var gulp = require('gulp');
var sass = require('gulp-sass');
var gulpif = require('gulp-if');
var sprity = require('sprity');
var browserSync = require('browser-sync');
var sourcemaps = require('gulp-sourcemaps');
var minifyCss = require('gulp-minify-css');
// Registering a 'less' task that just compile our LESS files to CSS
gulp.task('sprites', function () {
return sprity.src({
src: './resources/icons/icons/*.{png,jpg}',
style: './resources/sass/_sprite.scss',
// ... other optional options
// for example if you want to generate scss instead of css
processor: 'sass', // make sure you have installed sprity-sass
})
.pipe(gulpif('*.png', gulp.dest('./public/icons/'), gulp.dest('./resources/sass/')))
});
gulp.task('sass', function() {
gulp.src('./resources/sass/main.scss')
.pipe(sourcemaps.init())
.pipe(sass({
errLogToConsole: true
}))
.pipe(sourcemaps.write())
.pipe(minifyCss({compatibility: 'ie8'}))
.pipe(gulp.dest('./public/stylesheets'));
});
gulp.task('watch', ['sass'], function () {
gulp.watch('./resources/sass/{,*/}*.{scss,sass}', ['sass'])
});
//
gulp.task('serve', function () {
browserSync({
// By default, Play is listening on port 9000
proxy: 'localhost:9000',
// We will set BrowserSync on the port 9001
port: 9001,
// Reload all assets
// Important: you need to specify the path on your source code
// not the path on the url
files: ['public/stylesheets/*.css',
'public/javascripts/*.js',
'app/views/*.html',
'app/views/*.stream',
'app/views/product/*.html',
'app/controllers/{,*/}*.scala',
'conf/routes'],
open: false
});
});
// Creating the default gulp task
gulp.task('default', [ 'sass', 'watch']);