-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
executable file
·41 lines (37 loc) · 1.32 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
'use strict';
const gulp = require('gulp');
const sass = require('gulp-sass');
const sassGlob = require('gulp-sass-glob');
const autoprefixer = require('gulp-autoprefixer');
const uglifycss = require('gulp-uglifycss');
const include = require('gulp-include');
const addsrc = require('gulp-add-src');
const order = require('gulp-order');
const concat = require('gulp-concat');
const uglify = require('gulp-uglify');
const gutil = require('gulp-util')
gulp.task('sass', function() {
return gulp.src(['assets/stylesheets/*.scss'])
.pipe(sassGlob())
.pipe(sass().on('error', sass.logError))
.pipe(autoprefixer())
.pipe(uglifycss())
.pipe(gulp.dest('assets/stylesheets/'));
});
gulp.task('javascript', function() {
return gulp.src('assets/javascripts/application/*.js')
.pipe(addsrc('assets/javascripts/vendor/index.js'))
.pipe(order([
"assets/javascripts/vendor/index.js",
"assets/javascripts/application/*.js"
], {base: '.'}))
.pipe(include())
.pipe(concat('application.js'))
.pipe(uglify())
.on('error', function (err) { gutil.log(gutil.colors.red('[Error]'), err.toString()); })
.pipe(gulp.dest('assets/javascripts'));
});
gulp.task('watch', function() {
gulp.watch('assets/stylesheets/**/*.scss', ['sass']);
gulp.watch('assets/javascripts/application/*.js', ['javascript']);
});