mirror of
https://github.com/Ionaru/easy-markdown-editor
synced 2025-07-17 06:54:27 -06:00
Gulp file prettifies src files
This commit is contained in:
parent
cef2623e2a
commit
5e0aeee60d
34
gulpfile.js
34
gulpfile.js
@ -21,7 +21,19 @@ var banner = ["/**",
|
|||||||
" */",
|
" */",
|
||||||
""].join("\n");
|
""].join("\n");
|
||||||
|
|
||||||
gulp.task("lint", function() {
|
gulp.task("prettify-js", [], function() {
|
||||||
|
return gulp.src("./src/js/simplemde.js")
|
||||||
|
.pipe(prettify({js: {braceStyle: "collapse", indentChar: "\t", indentSize: 1, maxPreserveNewlines: 3, spaceBeforeConditional: false}}))
|
||||||
|
.pipe(gulp.dest("./src/js"));
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task("prettify-css", [], function() {
|
||||||
|
return gulp.src("./src/css/simplemde.css")
|
||||||
|
.pipe(prettify({css: {indentChar: "\t", indentSize: 1}}))
|
||||||
|
.pipe(gulp.dest("./src/css"));
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task("lint", ["prettify-js"], function() {
|
||||||
gulp.src("./src/js/**/*.js")
|
gulp.src("./src/js/**/*.js")
|
||||||
.pipe(debug())
|
.pipe(debug())
|
||||||
.pipe(eslint())
|
.pipe(eslint())
|
||||||
@ -34,14 +46,14 @@ function taskBrowserify(opts) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gulp.task("browserify:dev", [], function() {
|
gulp.task("browserify:dev", ["lint"], function() {
|
||||||
return taskBrowserify({debug:true, standalone:"SimpleMDE"})
|
return taskBrowserify({debug:true, standalone:"SimpleMDE"})
|
||||||
.pipe(source("simplemde.debug.js"))
|
.pipe(source("simplemde.debug.js"))
|
||||||
.pipe(header(banner, {pkg: pkg}))
|
.pipe(header(banner, {pkg: pkg}))
|
||||||
.pipe(gulp.dest("./debug/"));
|
.pipe(gulp.dest("./debug/"));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task("browserify:min", [], function() {
|
gulp.task("browserify:min", ["lint"], function() {
|
||||||
return taskBrowserify({standalone:"SimpleMDE"})
|
return taskBrowserify({standalone:"SimpleMDE"})
|
||||||
.pipe(source("simplemde.js"))
|
.pipe(source("simplemde.js"))
|
||||||
.pipe(header(banner, {pkg: pkg}))
|
.pipe(header(banner, {pkg: pkg}))
|
||||||
@ -50,6 +62,7 @@ gulp.task("browserify:min", [], function() {
|
|||||||
|
|
||||||
gulp.task("scripts", ["browserify:dev", "browserify:min", "lint"], function() {
|
gulp.task("scripts", ["browserify:dev", "browserify:min", "lint"], function() {
|
||||||
var js_files = ["./debug/simplemde.js"];
|
var js_files = ["./debug/simplemde.js"];
|
||||||
|
|
||||||
return gulp.src(js_files)
|
return gulp.src(js_files)
|
||||||
.pipe(concat("simplemde.min.js"))
|
.pipe(concat("simplemde.min.js"))
|
||||||
.pipe(uglify())
|
.pipe(uglify())
|
||||||
@ -57,12 +70,13 @@ gulp.task("scripts", ["browserify:dev", "browserify:min", "lint"], function() {
|
|||||||
.pipe(gulp.dest("./dist/"));
|
.pipe(gulp.dest("./dist/"));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task("styles", function() {
|
gulp.task("styles", ["prettify-css"], function() {
|
||||||
var css_files = [
|
var css_files = [
|
||||||
"./node_modules/codemirror/lib/codemirror.css",
|
"./node_modules/codemirror/lib/codemirror.css",
|
||||||
"./src/css/*.css",
|
"./src/css/*.css",
|
||||||
"./node_modules/codemirror-spell-checker/src/css/spell-checker.css"
|
"./node_modules/codemirror-spell-checker/src/css/spell-checker.css"
|
||||||
];
|
];
|
||||||
|
|
||||||
return gulp.src(css_files)
|
return gulp.src(css_files)
|
||||||
.pipe(concat("simplemde.css"))
|
.pipe(concat("simplemde.css"))
|
||||||
.pipe(header(banner, {pkg: pkg}))
|
.pipe(header(banner, {pkg: pkg}))
|
||||||
@ -73,16 +87,4 @@ gulp.task("styles", function() {
|
|||||||
.pipe(gulp.dest("./dist/"));
|
.pipe(gulp.dest("./dist/"));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task("prettify-js", function() {
|
|
||||||
gulp.src("./src/js/simplemde.js")
|
|
||||||
.pipe(prettify({js: {braceStyle: "collapse", indentChar: "\t", indentSize: 1, maxPreserveNewlines: 3, spaceBeforeConditional: false}}))
|
|
||||||
.pipe(gulp.dest("./src/js"));
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task("prettify-css", function() {
|
|
||||||
gulp.src("./src/css/simplemde.css")
|
|
||||||
.pipe(prettify({css: {indentChar: "\t", indentSize: 1}}))
|
|
||||||
.pipe(gulp.dest("./src/css"));
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task("default", ["scripts", "styles"]);
|
gulp.task("default", ["scripts", "styles"]);
|
Loading…
x
Reference in New Issue
Block a user