Blame view

bower_components/prism/gulpfile.js 1.32 KB
73bcce88   luigser   COMPONENTS
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
  var gulp   = require('gulp'),
  	rename = require('gulp-rename'),
  	uglify = require('gulp-uglify'),
  	header = require('gulp-header'),
  	concat = require('gulp-concat'),
  
  	paths  = {
  		components: ['components/**/*.js', '!components/**/*.min.js'],
  		main: [
  			'components/prism-core.js',
  			'components/prism-markup.js',
  			'components/prism-css.js',
  			'components/prism-clike.js',
  			'components/prism-javascript.js',
  			'plugins/file-highlight/prism-file-highlight.js'
  		],
  		plugins: ['plugins/**/*.js', '!plugins/**/*.min.js']
  	};
  
  gulp.task('components', function() {
  	return gulp.src(paths.components)
  		.pipe(uglify())
  		.pipe(rename({ suffix: '.min' }))
  		.pipe(gulp.dest('components'));
  });
  
  gulp.task('build', function() {
  	return gulp.src(paths.main)
  		.pipe(header('\n/* **********************************************\n' +
  			'     Begin <%= file.relative %>\n' +
  			'********************************************** */\n\n'))
  		.pipe(concat('prism.js'))
  		.pipe(gulp.dest('./'));
  });
  
  gulp.task('plugins', function() {
  	return gulp.src(paths.plugins)
  		.pipe(uglify())
  		.pipe(rename({ suffix: '.min' }))
  		.pipe(gulp.dest('plugins'));
  });
  
  gulp.task('watch', function() {
  	gulp.watch(paths.components, ['components', 'build']);
  	gulp.watch(paths.plugins, ['plugins', 'build']);
  });
  
  gulp.task('default', ['components', 'plugins', 'build']);