forked from BrowserSync/browser-sync
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
113 lines (94 loc) · 2.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
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
"use strict";
var gulp = require("gulp");
var jshint = require("gulp-jshint");
var contribs = require("gulp-contribs");
var rubySass = require("gulp-ruby-sass");
var filter = require("gulp-filter");
var browserSync = require("./index");
gulp.task("lint", function () {
gulp.src([
"*.js",
"lib/**/*.js",
"!lib/cli/cli-template.js",
"!lib/public/socket.io.js",
"test/specs/**/*.js",
"!test/fixtures/**"
])
.pipe(jshint("test/specs/.jshintrc"))
.pipe(jshint.reporter("default"))
.pipe(jshint.reporter("fail"));
});
gulp.task("contribs", function () {
gulp.src("README.md")
.pipe(contribs())
.pipe(gulp.dest("./"));
});
gulp.task("default", ["lint"]);
var paths = {
scss: "test/fixtures/scss/*.scss",
css: "test/fixtures/css",
cssGlob: "test/fixtures/assets/*.css",
html: "test/fixtures/*.html"
};
gulp.task("sass", function () {
browserSync.notify("Compiling SCSS files... Please Wait");
return gulp.src(paths.scss)
.pipe(rubySass({sourcemap: true}))
.pipe(gulp.dest(paths.css))
.pipe(filter("**/*.css"))
.pipe(browserSync.reload({stream:true}));
});
/**
* Start BrowserSync
*/
gulp.task("browser-sync", function () {
// var clientScript = require("/Users/shakyshane/Sites/browser-sync-modules/browser-sync-client/index");
//
// browserSync.use("client:script", clientScript.middleware, function (err) {
// console.log(err);
// });
browserSync({
server: {
baseDir: "test/fixtures"
},
startPath: "sass.html"
});
});
/**
* Start BrowserSync
*/
gulp.task("browser-sync-css", function () {
browserSync({
server: {
baseDir: "test/fixtures"
}
});
});
///**
// * Reload task
// */
//gulp.task("bs-reload", function () {
// browserSync.reload();
//});
/**
* Watch stuff
*/
gulp.task("watch", ["browser-sync"], function () {
gulp.watch(paths.scss, ["sass"]);
// gulp.watch(paths.html, ["bs-reload"]);
});
/**
* Watch stuff
*/
gulp.task("watch-css", ["browser-sync-css"], function () {
gulp.watch(paths.cssGlob, function (file) {
browserSync.reload(file.path);
});
gulp.watch(paths.html, browserSync.reload);
});
gulp.task("docs", function () {
var yuidoc = require("gulp-yuidoc");
gulp.src(["./index.js", "./lib/default-config.js"])
.pipe(yuidoc.parser({spaces: 4}))
.pipe(gulp.dest("./doc"));
});