This repository was archived by the owner on Apr 22, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathgulpfile.js
More file actions
65 lines (49 loc) · 1.88 KB
/
Copy pathgulpfile.js
File metadata and controls
65 lines (49 loc) · 1.88 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
65
var name = require('./package.json').moduleName,
fs = require('fs'),
gulp = require('gulp'),
plugins = require('gulp-load-plugins')()
var head = fs.readFileSync('./node_modules/@electerious/modulizer/head.js', { encoding: 'utf8' }),
foot = fs.readFileSync('./node_modules/@electerious/modulizer/foot.js', { encoding: 'utf8' })
var catchError = function(err) {
console.log(err.toString())
this.emit('end')
}
gulp.task('styles', function() {
gulp.src('./src/styles/main.scss')
.pipe(plugins.sass())
.on('error', catchError)
.pipe(plugins.concat(name + '.min.css', { newLine: "\n" }))
.pipe(plugins.autoprefixer('last 2 version', '> 1%'))
.pipe(plugins.minifyCss())
.pipe(gulp.dest('./dist'))
gulp.src('./src/styles/themes/*.scss')
.pipe(plugins.sass())
.on('error', catchError)
.pipe(plugins.rename(function(path) { path.basename += '.min' }))
.pipe(plugins.autoprefixer('last 2 version', '> 1%'))
.pipe(plugins.minifyCss())
.pipe(gulp.dest('./dist/themes'))
gulp.src('./src/styles/addons/*.scss')
.pipe(plugins.sass())
.on('error', catchError)
.pipe(plugins.rename(function(path) { path.basename += '.min' }))
.pipe(plugins.autoprefixer('last 2 version', '> 1%'))
.pipe(plugins.minifyCss())
.pipe(gulp.dest('./dist/addons'))
})
gulp.task('scripts', function() {
gulp.src('./src/scripts/*.js')
.pipe(plugins.header(head, { name: name }))
.pipe(plugins.footer(foot))
.pipe(plugins.babel())
.on('error', catchError)
.pipe(plugins.concat(name + '.min.js', { newLine: "\n" }))
.pipe(plugins.uglify())
.on('error', catchError)
.pipe(gulp.dest('./dist'))
})
gulp.task('default', ['styles', 'scripts'])
gulp.task('watch', ['styles', 'scripts'], function() {
gulp.watch('./src/styles/**/*.scss', ['styles'])
gulp.watch('./src/scripts/**/*.js', ['scripts'])
})