|
|
|
@ -1,28 +1,28 @@
|
|
|
|
|
"use strict";
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
|
|
var gulp = require("gulp"),
|
|
|
|
|
minifycss = require("gulp-clean-css"),
|
|
|
|
|
uglify = require("gulp-uglify"),
|
|
|
|
|
concat = require("gulp-concat"),
|
|
|
|
|
header = require("gulp-header"),
|
|
|
|
|
buffer = require("vinyl-buffer"),
|
|
|
|
|
pkg = require("./package.json"),
|
|
|
|
|
debug = require("gulp-debug"),
|
|
|
|
|
eslint = require("gulp-eslint"),
|
|
|
|
|
browserify = require("browserify"),
|
|
|
|
|
source = require("vinyl-source-stream"),
|
|
|
|
|
rename = require("gulp-rename");
|
|
|
|
|
var gulp = require('gulp'),
|
|
|
|
|
minifycss = require('gulp-clean-css'),
|
|
|
|
|
uglify = require('gulp-uglify'),
|
|
|
|
|
concat = require('gulp-concat'),
|
|
|
|
|
header = require('gulp-header'),
|
|
|
|
|
buffer = require('vinyl-buffer'),
|
|
|
|
|
pkg = require('./package.json'),
|
|
|
|
|
debug = require('gulp-debug'),
|
|
|
|
|
eslint = require('gulp-eslint'),
|
|
|
|
|
browserify = require('browserify'),
|
|
|
|
|
source = require('vinyl-source-stream'),
|
|
|
|
|
rename = require('gulp-rename');
|
|
|
|
|
|
|
|
|
|
var banner = ["/**",
|
|
|
|
|
" * <%= pkg.name %> v<%= pkg.version %>",
|
|
|
|
|
" * Copyright <%= pkg.author %>",
|
|
|
|
|
" * @link <%= pkg.repository.url %>",
|
|
|
|
|
" * @license <%= pkg.license %>",
|
|
|
|
|
" */",
|
|
|
|
|
""].join("\n");
|
|
|
|
|
var banner = ['/**',
|
|
|
|
|
' * <%= pkg.name %> v<%= pkg.version %>',
|
|
|
|
|
' * Copyright <%= pkg.author %>',
|
|
|
|
|
' * @link <%= pkg.repository.url %>',
|
|
|
|
|
' * @license <%= pkg.license %>',
|
|
|
|
|
' */',
|
|
|
|
|
''].join('\n');
|
|
|
|
|
|
|
|
|
|
gulp.task("lint", function () {
|
|
|
|
|
gulp.src("./src/js/**/*.js")
|
|
|
|
|
gulp.task('lint', function () {
|
|
|
|
|
gulp.src('./src/js/**/*.js')
|
|
|
|
|
.pipe(debug())
|
|
|
|
|
.pipe(eslint())
|
|
|
|
|
.pipe(eslint.format())
|
|
|
|
@ -30,54 +30,54 @@ gulp.task("lint", function () {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
function taskBrowserify(opts) {
|
|
|
|
|
return browserify("./src/js/simplemde.js", opts)
|
|
|
|
|
return browserify('./src/js/simplemde.js', opts)
|
|
|
|
|
.bundle();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gulp.task("browserify:debug", ["lint"], function () {
|
|
|
|
|
return taskBrowserify({debug: true, standalone: "SimpleMDE"})
|
|
|
|
|
.pipe(source("simplemde.debug.js"))
|
|
|
|
|
gulp.task('browserify:debug', ['lint'], function () {
|
|
|
|
|
return taskBrowserify({debug: true, standalone: 'SimpleMDE'})
|
|
|
|
|
.pipe(source('simplemde.debug.js'))
|
|
|
|
|
.pipe(buffer())
|
|
|
|
|
.pipe(header(banner, {pkg: pkg}))
|
|
|
|
|
.pipe(gulp.dest("./debug/"));
|
|
|
|
|
.pipe(gulp.dest('./debug/'));
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
gulp.task("browserify", ["lint"], function () {
|
|
|
|
|
return taskBrowserify({standalone: "SimpleMDE"})
|
|
|
|
|
.pipe(source("simplemde.js"))
|
|
|
|
|
gulp.task('browserify', ['lint'], function () {
|
|
|
|
|
return taskBrowserify({standalone: 'SimpleMDE'})
|
|
|
|
|
.pipe(source('simplemde.js'))
|
|
|
|
|
.pipe(buffer())
|
|
|
|
|
.pipe(header(banner, {pkg: pkg}))
|
|
|
|
|
.pipe(gulp.dest("./debug/"));
|
|
|
|
|
.pipe(gulp.dest('./debug/'));
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
gulp.task("scripts", ["browserify:debug", "browserify", "lint"], function () {
|
|
|
|
|
var js_files = ["./debug/simplemde.js"];
|
|
|
|
|
gulp.task('scripts', ['browserify:debug', 'browserify', 'lint'], function () {
|
|
|
|
|
var js_files = ['./debug/simplemde.js'];
|
|
|
|
|
|
|
|
|
|
return gulp.src(js_files)
|
|
|
|
|
.pipe(concat("simplemde.min.js"))
|
|
|
|
|
.pipe(concat('simplemde.min.js'))
|
|
|
|
|
.pipe(uglify())
|
|
|
|
|
.pipe(buffer())
|
|
|
|
|
.pipe(header(banner, {pkg: pkg}))
|
|
|
|
|
.pipe(gulp.dest("./dist/"));
|
|
|
|
|
.pipe(gulp.dest('./dist/'));
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
gulp.task("styles", function () {
|
|
|
|
|
gulp.task('styles', function () {
|
|
|
|
|
var css_files = [
|
|
|
|
|
"./node_modules/codemirror/lib/codemirror.css",
|
|
|
|
|
"./src/css/*.css",
|
|
|
|
|
"./node_modules/codemirror-spell-checker/src/css/spell-checker.css"
|
|
|
|
|
'./node_modules/codemirror/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(concat('simplemde.css'))
|
|
|
|
|
.pipe(buffer())
|
|
|
|
|
.pipe(header(banner, {pkg: pkg}))
|
|
|
|
|
.pipe(gulp.dest("./debug/"))
|
|
|
|
|
.pipe(gulp.dest('./debug/'))
|
|
|
|
|
.pipe(minifycss())
|
|
|
|
|
.pipe(rename("simplemde.min.css"))
|
|
|
|
|
.pipe(rename('simplemde.min.css'))
|
|
|
|
|
.pipe(buffer())
|
|
|
|
|
.pipe(header(banner, {pkg: pkg}))
|
|
|
|
|
.pipe(gulp.dest("./dist/"));
|
|
|
|
|
.pipe(gulp.dest('./dist/'));
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
gulp.task("default", ["scripts", "styles"]);
|
|
|
|
|
gulp.task('default', ['scripts', 'styles']);
|
|
|
|
|