-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
59 lines (45 loc) · 1.63 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
const gulp = require( 'gulp' )
, data = require( 'gulp-data' )
, favicons = require( 'favicons' ).stream
, fs = require( 'fs' )
, nunjucks = require( 'gulp-nunjucks' )
, sass = require( 'gulp-sass' )
;
sass.compiler = require( 'node-sass' );
gulp.task( 'build:sass', function() {
return gulp.src( './src/assets/sass/**/*.scss' )
.pipe( sass( {
includePaths: [ 'node_modules' ],
// outputStyle: 'compressed',
} ).on( 'error', sass.logError ) )
.pipe( gulp.dest( './docs/assets/css/' ) );
} );
gulp.task( 'build:html', function() {
return gulp.src( './src/index.html' )
.pipe( data( function() {
return JSON.parse( fs.readFileSync( './src/manifest.json' ) );
} ) )
.pipe( nunjucks.compile() )
.pipe( gulp.dest( './docs' ) );
} );
gulp.task( 'build:favicons', function() {
return gulp.src( './docs/assets/img/lifterlms_icon.png' )
.pipe( favicons( {
appName: 'LifterLMS Brand and Style Guide',
appShortName: 'LLMS',
appDescription: 'This is my application',
developerName: 'Team LifterLMS',
developerURL: 'https://lifterlms.com/',
path: './assets/favicons/',
html: '../../../src/_favicons.html',
pipeHTML: true,
replace: true
} ) )
.pipe( gulp.dest( './docs/assets/favicons' ) );
} );
gulp.task ( 'build', gulp.series( gulp.parallel( 'build:sass', 'build:favicons' ), 'build:html' ) );
gulp.task( 'watch', function() {
gulp.watch( './src/assets/sass/**/*.scss', gulp.parallel( 'build:sass' ) );
gulp.watch( './src/**/*.html', gulp.parallel( 'build:html' ) );
gulp.watch( './src/manifest.json', gulp.parallel( 'build:html' ) );
} );