/
html.js
37 lines (33 loc) · 897 Bytes
/
html.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
var gulp = require( 'gulp' );
var juice = require( '@akzhan/gulp-juice' );
var htmlmin = require( 'gulp-htmlmin' );
var connect = require( 'gulp-connect' );
// Require main configuration file
var config = require( '../config.js' );
// Export functions
exports.inline = inline;
exports.clean = clean;
// Inline CSS
function inline() {
return gulp.src( config.paths.html.inline.src )
.pipe( juice( {
applyHeightAttributes: false,
applyWidthAttributes: false,
xmlMode: true,
webResources: {
relativeTo: './dist',
images: false,
svgs: false,
scripts: false,
links: false,
},
} ) )
.pipe( gulp.dest( config.paths.html.inline.dest ) );
}
// Clean HTML
function clean() {
return gulp.src( config.paths.html.clean.src )
.pipe( htmlmin( config.paths.html.clean.options ) )
.pipe( gulp.dest( config.paths.html.clean.dest ) )
.pipe( connect.reload() );
}