Skip to content

Commit

Permalink
new transpiler to remove amd
Browse files Browse the repository at this point in the history
  • Loading branch information
gpoitch committed Jan 1, 2015
1 parent a4129a0 commit 874115f
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 173 deletions.
25 changes: 3 additions & 22 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,13 @@ var header = require('gulp-header');
var util = require('gulp-util');
var open = require('gulp-open');
var rimraf = require('gulp-rimraf');
var insert = require('gulp-insert');
var gulpif = require('gulp-if');
var es6ModuleTranspiler = require('gulp-es6-module-transpiler');
var transpile = require('gulp-es6-module-transpiler');

// -------------------------------------------

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

var jsSrc = [
'./src/js/ext/loader.js',
'./src/js/content-kit.js',
'./src/js/**/*.js'
];

Expand All @@ -35,7 +31,6 @@ var cssSrc = [
var distDest = './dist/';
var jsDistName = 'content-kit-editor.js';
var jsDistPath = distDest + jsDistName;
var pathIsES6File = /^((?!loader).)*$/;
var cssDistName = 'content-kit-editor.css';

var testRunner = './tests/index.html';
Expand All @@ -52,31 +47,17 @@ var banner = ['/*!',
' */',
''].join('\n');

var iifeHeader = ['',
'(function(exports, document) {',
'',
'\'use strict\';',
'',
''].join('\n');
var iifeFooter = ['',
'}(this, document));',
''].join('\n');

var AMDInvoke = "if (typeof window !== 'undefined') { window.ContentKit = require('content-kit')['default']; }"

// JSHint javascript code linting
gulp.task('lint', function() {
return gulp.src(jsSrc)
.pipe(gulpif(pathIsES6File, jshint('.jshintrc')))
.pipe(jshint('.jshintrc'))
.pipe(jshint.reporter('default'));
});

gulp.task('build-js', ['lint'], function() {
return gulp.src(jsSrc)
.pipe(gulpif(pathIsES6File, es6ModuleTranspiler({ type: 'amd' })))
.pipe(transpile({ formatter: 'bundle' }))
.pipe(concat(jsDistName))
.pipe(insert.append(AMDInvoke))
.pipe(insert.wrap(iifeHeader, iifeFooter))
.pipe(header(banner, { pkg : pkg } ))
.pipe(gulp.dest(distDest));
});
Expand Down
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,10 @@
"express": "^4.9.0"
},
"devDependencies": {
"gulp": "^3.8.1",
"gulp": "^3.8.10",
"gulp-concat": "~2.1.7",
"gulp-es6-module-transpiler": "^0.1.3",
"gulp-es6-module-transpiler": "^0.2.0",
"gulp-header": "~1.0.2",
"gulp-if": "^1.2.4",
"gulp-insert": "^0.4.0",
"gulp-jshint": "~1.3.4",
"gulp-less": "^1.3.1",
"gulp-open": "^0.2.8",
Expand Down
1 change: 0 additions & 1 deletion src/js/content-kit-editor/views/prompt.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import View from './view';
import { inherit } from '../../content-kit-utils/object-utils';
import { inherit } from '../../content-kit-utils/object-utils';
import { restoreRange } from '../utils/selection-utils';
import { createDiv, positionElementToRect } from '../utils/element-utils';
import Keycodes from '../utils/keycodes';
Expand Down
2 changes: 1 addition & 1 deletion src/js/content-kit.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ ContentKit.HTMLParser = HTMLParser;
ContentKit.HTMLRenderer = HTMLRenderer;
ContentKit.Editor = EditorFactory;

export default ContentKit;
window.ContentKit = ContentKit;
145 changes: 0 additions & 145 deletions src/js/ext/loader.js

This file was deleted.

0 comments on commit 874115f

Please sign in to comment.