Skip to content

Commit

Permalink
more deploy goodies
Browse files Browse the repository at this point in the history
  • Loading branch information
gpoitch committed Jan 28, 2015
1 parent 7510ee0 commit 8cbfaab
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 21 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ContentKit-Editor [![Build Status](https://travis-ci.org/ContentKit/content-kit-editor.svg?branch=master)](https://travis-ci.org/ContentKit/content-kit-editor)
# ContentKit-Editor [![Build Status](https://travis-ci.org/bustlelabs/content-kit-editor.svg?branch=master)](https://travis-ci.org/bustlelabs/content-kit-editor)
### A modern, minimalist WYSIWYG editor.

*Currently under heavy active development. API subject to change.*
Expand Down
58 changes: 40 additions & 18 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
var gulp = require('gulp');
var jshint = require('gulp-jshint');
var qunit = require('gulp-qunit');
var less = require('gulp-less');
var concat = require('gulp-concat');
var header = require('gulp-header');
var util = require('gulp-util');
var open = require('gulp-open');
var rimraf = require('gulp-rimraf');
var del = require('del');
var gulp = require('gulp');
var jshint = require('gulp-jshint');
var qunit = require('gulp-qunit');
var less = require('gulp-less');
var concat = require('gulp-concat');
var header = require('gulp-header');
var footer = require('gulp-footer');
var util = require('gulp-util');
var open = require('gulp-open');
var replace = require('gulp-replace');
var uglify = require('gulp-uglify');
var cssmin = require('gulp-cssmin');
var transpile = require('gulp-es6-module-transpiler');

// -------------------------------------------
Expand All @@ -28,17 +32,17 @@ var cssSrc = [
'./src/css/animations.less'
];

var distDest = './dist/';
var jsDistName = 'content-kit-editor.js';
var jsDistPath = distDest + jsDistName;
var distDest = './dist/';
var jsDistName = 'content-kit-editor.js';
var cssDistName = 'content-kit-editor.css';
var jsDistPath = distDest + jsDistName;
var cssDistPath = distDest + cssDistName;

var testRunner = './tests/index.html';
var testRunner = './tests/index.html';
var testScripts = './tests/**/*.js';
var demo = './demo/index.html';

var demo = './demo/index.html';

var banner = ['/*!',
var banner = ['/**',
' * @overview <%= pkg.name %>: <%= pkg.description %>',
' * @version <%= pkg.version %>',
' * @author <%= pkg.author %>',
Expand All @@ -47,6 +51,9 @@ var banner = ['/*!',
' */',
''].join('\n');

var iifeHeader = '\n(function(window, document, undefined) {\n\n';
var iifeFooter = '\n}(this, document));\n';

// JSHint javascript code linting
gulp.task('lint', function() {
return gulp.src(jsSrc)
Expand All @@ -58,6 +65,13 @@ gulp.task('build-js', function() {
return gulp.src(jsSrc)
.pipe(transpile({ formatter: 'bundle' }))
.pipe(concat(jsDistName))
// Remove gulp-es6-module-transpiler's IIFE so we can add our own
.pipe(replace(/^\(function\(\) {\n/g, ''))
.pipe(replace(/\}\)\.call\(this\);\n/g, ''))
.pipe(replace(/\n\/\/# sourceMappingURL\=bundle\.map/g, ''))
// end IFFE removal
.pipe(header(iifeHeader))
.pipe(footer(iifeFooter))
.pipe(header(banner, { pkg : pkg } ))
.pipe(gulp.dest(distDest));
});
Expand Down Expand Up @@ -90,7 +104,7 @@ gulp.task('demo', function(){

// Removes built output files
gulp.task('clean', function() {
return gulp.src(distDest + '*', { read: false }).pipe(rimraf());
return del([distDest + '*']);
});

// Watches when js files change and automatically lints/builds
Expand All @@ -115,4 +129,12 @@ gulp.task('watch', ['watch-js', 'watch-tests', 'watch-css']);
gulp.task('default', ['lint', 'build', 'test']);

// Deploy task
gulp.task('heroku:production', ['build']); // TODO: minify assets etc...
gulp.task('heroku:production', ['clean', 'build'], function() {
gulp.src(jsDistPath)
.pipe(uglify())
.pipe(gulp.dest(distDest));

gulp.src(cssDistPath)
.pipe(cssmin())
.pipe(gulp.dest(distDest));
});
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,19 @@
"express": "^4.11.1"
},
"devDependencies": {
"del": "^1.1.1",
"gulp": "^3.8.10",
"gulp-concat": "~2.1.7",
"gulp-cssmin": "^0.1.6",
"gulp-es6-module-transpiler": "^0.2.0",
"gulp-header": "~1.0.2",
"gulp-footer": "^1.0.5",
"gulp-header": "^1.2.2",
"gulp-jshint": "~1.3.4",
"gulp-less": "^1.3.1",
"gulp-open": "^0.2.8",
"gulp-qunit": "^0.3.3",
"gulp-rimraf": "^0.1.0",
"gulp-replace": "^0.5.2",
"gulp-uglify": "^1.1.0",
"gulp-util": "~2.2.12",
"qunitjs": "^1.15.0"
}
Expand Down

0 comments on commit 8cbfaab

Please sign in to comment.