-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathextracting----wip---gulpfile.js
More file actions
executable file
·64 lines (55 loc) · 2.1 KB
/
extracting----wip---gulpfile.js
File metadata and controls
executable file
·64 lines (55 loc) · 2.1 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
64
// jshint ignore: start
'use strict';
var gulp = require('gulp');
var sass = require('gulp-sass');
var sourcemaps = require('gulp-sourcemaps');
var sassGlob = require('gulp-sass-glob');
var rename = require('gulp-rename');
var uglify = require('gulp-uglify');
// Some configs:
// Here we define which sass dirs we should process/watch and which exclude.
var sassSrcDirs = ['sass/**/*.scss', '!sass/external-libraries', '!sass/external-libraries/**'];
// Here we define which external sass dirs we should process.
// Externals are sass frameworks that only needs to be compiled once.
var sassExternalsSrcDirs = 'sass/external-libraries/external-libraries.scss';
// Here we define which js dirs we should process/watch and which exclude.
var jsSrcDirs = ['js/**/*.js', '!js/**/*.min.js'];
// Generates a minified version for each theme's js file.
gulp.task('scripts', function () {
gulp.src(jsSrcDirs)
.pipe(sourcemaps.init())
.pipe(uglify())
.pipe(rename({suffix: '.min'}))
.pipe(sourcemaps.write('sourcemaps'))
.pipe(gulp.dest('js'))
});
// Compiles sass files and moves the result to dist.
gulp.task('sass', function () {
return gulp.src(sassSrcDirs)
.pipe(sassGlob())
.pipe(sourcemaps.init())
.pipe(sass({
outputStyle: 'expanded',
includePaths: ['./node_modules/breakpoint-sass/stylesheets']
}).on('error', sass.logError))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('css'));
});
// Compiles external sass files and moves the result to dist.
gulp.task('sass-externals', function () {
return gulp.src(sassExternalsSrcDirs)
.pipe(sassGlob())
.pipe(sourcemaps.init())
.pipe(sass({outputStyle: 'expanded'}).on('error', sass.logError))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('css'));
});
// -------------------------------------------------
// Build.
gulp.task('build', ['sass', 'scripts']);
gulp.task('build-externals', ['sass-externals']);
// Watch changes in general and detect when something relevant gets changed.
gulp.task('watch', ['build'], function () {
var watchDirs = sassSrcDirs.concat(jsSrcDirs);
gulp.watch(watchDirs, ['build']);
});