forked from Gommorach/inscryb-markdown-editor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
61 lines (54 loc) · 1.62 KB
/
gulpfile.js
File metadata and controls
61 lines (54 loc) · 1.62 KB
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
'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'),
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');
gulp.task('lint', function() {
gulp.src('./src/js/**/*.js')
.pipe(eslint())
.pipe(eslint.format());
});
gulp.task('scripts', ['lint'], function() {
return browserify({
entries: './src/js/inscrybmde.js',
standalone: 'InscrybMDE'
})
.bundle()
.pipe(source('inscrybmde.min.js'))
.pipe(buffer())
.pipe(uglify())
.pipe(header(banner, { pkg: pkg }))
.pipe(gulp.dest('./dist/'));
});
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'
];
return gulp
.src(css_files)
.pipe(concat('inscrybmde.css'))
.pipe(minifycss())
.pipe(rename('inscrybmde.min.css'))
.pipe(buffer())
.pipe(header(banner, { pkg: pkg }))
.pipe(gulp.dest('./dist/'));
});
gulp.task('default', ['scripts', 'styles']);