-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
41 lines (36 loc) · 1.48 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
var gulp = require('gulp');
var sass = require('gulp-sass');
var autoprefixer = require('gulp-autoprefixer');
var fs = require('fs');
var replace = require('gulp-replace');
var cssmin = require('gulp-cssmin');
var clean = require('gulp-clean');
gulp.task('default', ['injectjs'] ,function() {
gulp.start('clean');
});
gulp.task('css', function () {
return gulp.src('rawr.scss')
.pipe(sass().on('error', sass.logError))
.pipe(autoprefixer({
browsers: ['last 2 versions', '> 5%']
}))
.pipe(cssmin())
.pipe(gulp.dest(''));
});
gulp.task('injectcss',['css'] ,function () {
return gulp.src('inlinecss.js')
.pipe(replace('rawr.css', fs.readFileSync('rawr.css', 'utf8')))
.pipe(gulp.dest('inline'));
});
gulp.task('injectjs',['injectcss'] ,function () {
return gulp.src('rawr.js')
.pipe(replace('//inline css here', fs.readFileSync('inline/inlinecss.js', 'utf8')))
.pipe(replace('makeRaptor.root + \'media/raptor.png', "'data:image/png;base64," + new Buffer(fs.readFileSync('media/raptor.png')).toString('base64') ) )
.pipe(replace('makeRaptor.root + \'media/rawr.mp3', "'data:audio/mp3;base64," + new Buffer(fs.readFileSync('media/rawr.mp3')).toString('base64') ) )
.pipe(replace('makeRaptor.root + \'media/rawr.ogg', "'data:audio/ogg;base64," + new Buffer(fs.readFileSync('media/rawr.ogg')).toString('base64') ) )
.pipe(gulp.dest('inline'));
});
gulp.task('clean', function () {
return gulp.src('inline/inlinecss.js', {read: false})
.pipe(clean());
});