forked from sparksuite/simplemde-markdown-editor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
75 lines (65 loc) · 1.99 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
"use strict";
var gulp = require("gulp"),
minifycss = require("gulp-clean-css"),
concat = require("gulp-concat"),
header = require("gulp-header"),
buffer = require("vinyl-buffer"),
pkg = require("./package.json"),
debug = require("gulp-debug"),
browserify = require("browserify"),
source = require("vinyl-source-stream"),
rename = require("gulp-rename");
var banner = [
"/**",
" * <%= pkg.name %> v<%= pkg.version %>",
" * Copyright <%= pkg.company %>",
" * @link <%= pkg.homepage %>",
" * @license <%= pkg.license %>",
" */",
"",
].join("\n");
function taskBrowserify(opts) {
return browserify("./src/js/simplemde.js", opts).bundle();
}
gulp.task("browserify:debug", [], function () {
return taskBrowserify({ debug: true, standalone: "SimpleMDE" })
.pipe(source("simplemde.debug.js"))
.pipe(buffer())
.pipe(header(banner, { pkg: pkg }))
.pipe(gulp.dest("./debug/"));
});
gulp.task("browserify", [], function () {
return taskBrowserify({ standalone: "SimpleMDE" })
.pipe(source("simplemde.js"))
.pipe(buffer())
.pipe(header(banner, { pkg: pkg }))
.pipe(gulp.dest("./debug/"));
});
gulp.task("scripts", ["browserify:debug", "browserify"], function () {
var js_files = ["./debug/simplemde.js"];
return gulp
.src(js_files)
.pipe(concat("simplemde.min.js"))
.pipe(buffer())
.pipe(header(banner, { pkg: pkg }))
.pipe(gulp.dest("./dist/"));
});
gulp.task("styles", [], function () {
var css_files = [
"./node_modules/@sealcode/sealcodemirror/lib/codemirror.css",
"./src/css/*.css",
"./node_modules/codemirror-spell-checker/src/css/spell-checker.css",
];
return gulp
.src(css_files)
.pipe(concat("simplemde.css"))
.pipe(buffer())
.pipe(header(banner, { pkg: pkg }))
.pipe(gulp.dest("./debug/"))
.pipe(minifycss())
.pipe(rename("simplemde.min.css"))
.pipe(buffer())
.pipe(header(banner, { pkg: pkg }))
.pipe(gulp.dest("./dist/"));
});
gulp.task("default", ["scripts", "styles"]);