-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
gulpfile.js
68 lines (58 loc) · 1.74 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
60
61
62
63
64
65
66
67
68
// Include gulp
var gulp = require( "gulp" );
// Include our plugins
var jshint = require( "gulp-jshint" );
var bootlint = require( "gulp-bootlint" );
var uglify = require( "gulp-uglify" );
var rename = require( "gulp-rename" );
var bootlint = require( "gulp-bootlint" );
var html5lint = require( "gulp-html5-lint" );
var checkPages = require( "check-pages" );
// Default task
gulp.task( "default", [ "js", "html", "bootstrap", "links", "minify" ] );
// Lint our JavaScript files
gulp.task( "js", function() {
return gulp.src( "src/**/*.js" )
.pipe( jshint() )
.pipe( jshint.reporter( "default" ) );
} );
gulp.task( "html", function() {
return gulp.src( [ "*.html", "examples/*.html" ] )
.pipe( html5lint() );
} );
// Lint our Bootstrap files
gulp.task( "bootstrap", function() {
return gulp.src( [ "*.html", "examples/**/*.html" ] )
.pipe( bootlint() );
} );
// Check for broken and invalid links in the web pages
gulp.task( "links", function( callback ) {
var options = {
pageUrls: [
"index.html",
"examples/basic.html",
"examples/clear-formatting.html",
"examples/events.html",
"examples/form-post.html",
"examples/formatblock-example.html",
"examples/html-editor.html",
"examples/multiple-editors.html",
"examples/simple-toolbar.html"
],
checkLinks: true,
summary: true
};
checkPages( console, options, callback );
} );
// Minify our JS
gulp.task( "minify", function() {
return gulp.src( "src/*.js" )
.pipe( uglify() )
.pipe( rename( "bootstrap-wysiwyg.min.js" ) )
.pipe( gulp.dest( "js" ) );
} );
// Watch files for changes
gulp.task( "watch", function() {
gulp.watch( [ "src/*.js", "index.html", "examples/*.html" ],
[ "js", "html", "bootstrap", "links", "minify" ] );
} );