-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
43 lines (38 loc) · 1.3 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
var gulp = require('gulp'),
sass = require('gulp-ruby-sass'),
autoprefixer = require('gulp-autoprefixer'),
react = require('gulp-react');
// Sass task : $ gulp sass to run
gulp.task('sass', function() {
gulp.src('sass/style.sass')
.pipe(sass({
style: 'expanded', // default: 'nested'. Other options: 'compact', 'compressed', 'expanded'
debugInfo: false //use Firesass Firebug plugin if true
}))
.on('error', function (err) { console.log(err.message); })
.pipe(gulp.dest('public/css'));
});
// Autoprefixer task : $ gulp prefix to run
gulp.task('prefix', function() {
gulp.src('public/css/main.css')
.pipe(autoprefixer({
browsers: ['last 2 versions'], //see documentation to expand compability
cascade: true //for nice and beautiful cascades
}))
.pipe(gulp.dest('public/css/main.css'));
});
// React procompiler task : $ gulp react to run
gulp.task('react', function() {
gulp.src('pathtoreplace/filetoreplace.jsx')
.pipe(react())
.pipe(gulp.dest('destinationpath'));
});
// File watchers
gulp.watch('sass/**/*.sass', ['sass']);
gulp.watch('public/css/*.css', ['prefix']);
// Default task : $ gulp to run
gulp.task('default', [
'sass'
//no need to call 'prefix'. It will trigger after sass task has finished
//add the 'react' task when you are ready
]);