Skip to content

Commit

Permalink
Add gulpfile.js
Browse files Browse the repository at this point in the history
  • Loading branch information
haroldtreen committed Jan 12, 2016
1 parent c0873e5 commit ed2670b
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 12 deletions.
30 changes: 22 additions & 8 deletions Gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
var gulp = require('gulp');
var browserify = require('gulp-browserify');
var rename = require('gulp-rename');
var uglify = require('gulp-uglify');
var cssNano = require('gulp-cssnano');
var merge = require('gulp-merge');
var del = require('del');

var packageInfo = require('./package.json');

// Basic usage
gulp.task('build', function() {
// Single entry point to browserify
gulp.src(['src/*.js', 'lib/*.js'])
.pipe(browserify({
transform: ['babelify'],
insertGlobals : true
}))
.pipe(gulp.dest('./build'));
var minifiedJs = gulp.src(['src/*.js'])
.pipe(uglify())
.pipe(rename(`${packageInfo.name}.min.js`));

var minifiedCss = gulp.src(['src/*.css'])
.pipe(cssNano())
.pipe(rename(`${packageInfo.name}.min.css`));

return merge(minifiedJs, minifiedCss).pipe(gulp.dest('./build'));
});

gulp.task('clean', () => {
del('build/*.js');
});

gulp.task('default', ['clean', 'build']);
12 changes: 8 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
"name": "show-code",
"version": "0.6.0",
"description": "Use the source code of a container as the background for that container!",
"main": "index.js",
"main": "src/show-code.js",
"directories": {
"example": "example"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"prepublish": "gulp"
},
"repository": {
"type": "git",
Expand All @@ -28,8 +29,11 @@
},
"homepage": "https://github.com/haroldtreen/show-code#readme",
"devDependencies": {
"babelify": "^7.2.0",
"del": "^2.2.0",
"gulp": "^3.9.0",
"gulp-browserify": "^0.5.1"
"gulp-cssnano": "^2.1.0",
"gulp-merge": "^0.1.1",
"gulp-rename": "^1.2.2",
"gulp-uglify": "^1.5.1"
}
}

0 comments on commit ed2670b

Please sign in to comment.