Skip to content

Commit

Permalink
Introduce gulp build process.
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-eb committed May 26, 2014
1 parent 2323537 commit 44af8f4
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .gitignore
@@ -1 +1,2 @@
hide-*.js
hide-*.js
node_modules
46 changes: 46 additions & 0 deletions gulpfile.js
@@ -0,0 +1,46 @@
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']);
});
9 changes: 8 additions & 1 deletion package.json
Expand Up @@ -16,5 +16,12 @@
],
"author": "Lea Verou",
"license": "MIT",
"readmeFilename": "README.md"
"readmeFilename": "README.md",
"devDependencies": {
"gulp": "^3.6.2",
"gulp-concat": "^2.2.0",
"gulp-header": "^1.0.2",
"gulp-rename": "^1.2.0",
"gulp-uglify": "^0.3.0"
}
}

0 comments on commit 44af8f4

Please sign in to comment.