Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed library to be OOP #81

Merged
merged 2 commits into from
Jan 20, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .jscsrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"preset": "jquery",
"maximumLineLength": 175, // Debatable: the jQuery preset sets this to 100, which prevents a lot of our if statements and function declarations from being on the same line,
"validateLineBreaks": "CRLF"
}
14 changes: 14 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"boss": true,
"curly": true,
"eqeqeq": true,
"eqnull": true,
"expr": true,
"immed": true,
"noarg": true,
"quotmark": "double",
"undef": true,
"unused": true,

"node": true
}
95 changes: 56 additions & 39 deletions gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,40 @@
module.exports = function (grunt) {

grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
module.exports = function( grunt ) {
grunt.initConfig( {
pkg: grunt.file.readJSON( "package.json" ),
jshint: {
all: ['gruntfile.js', 'gulpfile.js', 'src/**/*.js']
all: {
src: [
"gruntfile.js", "gulpfile.js", "src/**/*.js"
],
options: {
jshintrc: true
}
}
},
jscs: {
src: [ "gruntfile.js", "gulpfile.js", "src/**/*.js" ],
options: {
config: ".jscsrc",
fix: true // Autofix code style violations when possible
}
},
bootlint: {
options: {},
files: ['*.html', 'examples/**/*.html']
files: [ "*.html", "examples/**/*.html" ]
},
checkPages: {
development: {
options: {
pageUrls: [
'index.html',
'examples/basic.html',
'examples/clear-formatting.html',
'examples/events.html',
'examples/form-post.html',
'examples/formatblock-example.html',
'examples/html-editor.html',
'examples/multiple-editors.html',
'examples/simple-toolbar.html'
"index.html",
"examples/basic.html",
"examples/clear-formatting.html",
"examples/events.html",
"examples/form-post.html",
"examples/formatblock-example.html",
"examples/html-editor.html",
"examples/multiple-editors.html",
"examples/simple-toolbar.html"
],
checkLinks: true,
summary: true
Expand All @@ -30,45 +43,49 @@ module.exports = function (grunt) {
},
uglify: {
options: {
banner: '/* @fileoverview \n' +
' * Provides full Bootstrap based, multi-instance WYSIWYG editor. \n' +
' * \n' +
' * Name = ' + '<%= pkg.name %> \n' +
' * Author = ' + 'Various, see LICENCE \n' +
' * Version = ' + 'v<%= pkg.version %> \n' +
' * About = ' + 'A tiny Bootstrap and jQuery based WYSIWYG rich text editor based on the browser function execCommand. \n' +
'*/ \n\n'
banner: "/* @fileoverview \n" +
" * Provides full Bootstrap based, multi-instance WYSIWYG editor.\n" +
" *\n" +
" * Name = " + "<%= pkg.name %>\n" +
" * Author = " + "Various, see LICENCE\n" +
" * Version = " + "v<%= pkg.version %>\n" +
" * About = " + "A tiny Bootstrap and jQuery based WYSIWYG rich text editor" +
" based on the browser function execCommand.\n*/\n\n"
},
dist: {
files: {
'js/bootstrap-wysiwyg.min.js': ['src/**/*.js']
},
"js/bootstrap-wysiwyg.min.js": [ "src/**/*.js" ]
}
}
},
release: {
options: {
additionalFiles: ['bower.json', 'src/bootstrap-wysiwyg.js'],
additionalFiles: [ "bower.json", "src/bootstrap-wysiwyg.js" ],
commit: false,
npm: false,
npmTag: false,
push: false,
pushTags: false,
tag: false
}
}
},
watch: {
files: ['gruntfile.js', 'gulpfile.js', 'src/**/*.js', '*.html', 'examples/**/*.html'],
tasks: ['jshint', 'bootlint', 'checkPages', 'uglify']
files: [ "gruntfile.js", "gulpfile.js", "src/**/*.js", "*.html", "examples/**/*.html" ],
tasks: [ "jshint", "bootlint", "checkPages", "uglify" ]
}
});
} );

grunt.loadNpmTasks( "grunt-check-pages" );
grunt.loadNpmTasks( "grunt-bootlint" );
grunt.loadNpmTasks( "grunt-contrib-jshint" );
grunt.loadNpmTasks( "grunt-contrib-rename" );
grunt.loadNpmTasks( "grunt-contrib-uglify" );
grunt.loadNpmTasks( "grunt-contrib-watch" );
grunt.loadNpmTasks( "grunt-jscs" );
grunt.loadNpmTasks( "grunt-release" );

grunt.loadNpmTasks('grunt-check-pages');
grunt.loadNpmTasks('grunt-bootlint');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-rename');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-release');
grunt.registerTask( "default", [ "lint", "watch" ] );
grunt.registerTask( "lint", [ "jshint", "jscs", "bootlint", "checkPages" ] );
grunt.registerTask( "deploy", [ "lint", "uglify" ] );

grunt.registerTask('default', ['jshint', 'bootlint', 'checkPages', 'uglify', 'watch']);
};
};
87 changes: 44 additions & 43 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,67 +1,68 @@
// Include gulp
var gulp = require('gulp');
var gulp = require( "gulp" );

// Include our plugins
var jshint = require('gulp-jshint');
var bootlint = require('gulp-bootlint');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var bootlint = require('gulp-bootlint');
var html5lint = require('gulp-html5-lint');
var jshint = require( "gulp-jshint" );
var bootlint = require( "gulp-bootlint" );
var uglify = require( "gulp-uglify" );
var rename = require( "gulp-rename" );
var bootlint = require( "gulp-bootlint" );
var html5lint = require( "gulp-html5-lint" );

var checkPages = require('check-pages');
var checkPages = require( "check-pages" );

// Default task
gulp.task('default', ['js', 'html', 'bootstrap', 'links', 'minify']);
gulp.task( "default", [ "js", "html", "bootstrap", "links", "minify" ] );

// Lint our JavaScript files
gulp.task('js', function () {
return gulp.src('src/**/*.js')
.pipe(jshint())
.pipe(jshint.reporter('default'));
});
gulp.task( "js", function() {
return gulp.src( "src/**/*.js" )
.pipe( jshint() )
.pipe( jshint.reporter( "default" ) );
} );

gulp.task('html', function () {
return gulp.src(['*.html', 'examples/*.html'])
.pipe(html5lint());
});
gulp.task( "html", function() {
return gulp.src( [ "*.html", "examples/*.html" ] )
.pipe( html5lint() );
} );

// Lint our Bootstrap files
gulp.task('bootstrap', function () {
return gulp.src(['*.html', 'examples/**/*.html'])
.pipe(bootlint());
});
gulp.task( "bootstrap", function() {
return gulp.src( [ "*.html", "examples/**/*.html" ] )
.pipe( bootlint() );
} );

// Check for broken and invalid links in the web pages
gulp.task('links', function (callback) {
gulp.task( "links", function( callback ) {
var options = {
pageUrls: [
'index.html',
'examples/basic.html',
'examples/clear-formatting.html',
'examples/events.html',
'examples/form-post.html',
'examples/formatblock-example.html',
'examples/html-editor.html',
'examples/multiple-editors.html',
'examples/simple-toolbar.html'
"index.html",
"examples/basic.html",
"examples/clear-formatting.html",
"examples/events.html",
"examples/form-post.html",
"examples/formatblock-example.html",
"examples/html-editor.html",
"examples/multiple-editors.html",
"examples/simple-toolbar.html"
],
checkLinks: true,
summary: true
};

checkPages(console, options, callback);
});
checkPages( console, options, callback );
} );

// Minify our JS
gulp.task('minify', function () {
return gulp.src('src/*.js')
.pipe(uglify())
.pipe(rename('bootstrap-wysiwyg.min.js'))
.pipe(gulp.dest('js'));
});
gulp.task( "minify", function() {
return gulp.src( "src/*.js" )
.pipe( uglify() )
.pipe( rename( "bootstrap-wysiwyg.min.js" ) )
.pipe( gulp.dest( "js" ) );
} );

// Watch files for changes
gulp.task('watch', function () {
gulp.watch(['src/*.js', 'index.html', 'examples/*.html'], ['js', 'html', 'bootstrap', 'links', 'minify']);
});
gulp.task( "watch", function() {
gulp.watch( [ "src/*.js", "index.html", "examples/*.html" ],
[ "js", "html", "bootstrap", "links", "minify" ] );
} );
11 changes: 10 additions & 1 deletion js/bootstrap-wysiwyg.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading