2
0
mirror of https://github.com/Ionaru/easy-markdown-editor synced 2025-06-27 13:11:01 -06:00
easy-markdown-editor/gulpfile.js

56 lines
1.6 KiB
JavaScript
Raw Normal View History

2017-12-05 11:56:56 +01:00
'use strict';
2017-12-05 11:56:56 +01:00
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'),
eslint = require('gulp-eslint'),
browserify = require('browserify'),
source = require('vinyl-source-stream'),
rename = require('gulp-rename');
2017-12-05 11:56:56 +01:00
var banner = ['/**',
' * <%= pkg.name %> v<%= pkg.version %>',
' * Copyright <%= pkg.author %>',
' * @link <%= pkg.repository.url %>',
' * @license <%= pkg.license %>',
' */',
''].join('\n');
2017-12-05 11:56:56 +01:00
gulp.task('lint', function () {
gulp.src('./src/js/**/*.js')
2017-12-05 11:51:36 +01:00
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
2017-12-05 12:15:24 +01:00
gulp.task('scripts', ['lint'], function () {
2018-04-23 15:18:49 +02:00
return browserify({entries: './src/js/easymde.js', standalone: 'EasyMDE'}).bundle()
.pipe(source('easymde.min.js'))
2017-12-05 11:51:36 +01:00
.pipe(buffer())
.pipe(uglify())
.pipe(header(banner, {pkg: pkg}))
2017-12-05 11:56:56 +01:00
.pipe(gulp.dest('./dist/'));
2015-07-21 15:12:32 +01:00
});
2017-12-05 11:56:56 +01:00
gulp.task('styles', function () {
2017-12-05 11:51:36 +01:00
var css_files = [
2017-12-05 11:56:56 +01:00
'./node_modules/codemirror/lib/codemirror.css',
'./src/css/*.css',
'./node_modules/codemirror-spell-checker/src/css/spell-checker.css'
2017-12-05 11:51:36 +01:00
];
return gulp.src(css_files)
2018-04-23 15:18:49 +02:00
.pipe(concat('easymde.css'))
2017-12-05 11:51:36 +01:00
.pipe(minifycss())
2018-04-23 15:18:49 +02:00
.pipe(rename('easymde.min.css'))
2017-12-05 11:51:36 +01:00
.pipe(buffer())
.pipe(header(banner, {pkg: pkg}))
2017-12-05 11:56:56 +01:00
.pipe(gulp.dest('./dist/'));
2015-07-21 15:12:32 +01:00
});
2017-12-05 11:56:56 +01:00
gulp.task('default', ['scripts', 'styles']);