Skip to content
This repository has been archived by the owner on Mar 8, 2019. It is now read-only.

add grunt support #368

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
.tm_sync.config
.idea
/node_modules/
misc/cookies.txt
72 changes: 72 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
'use strict';

module.exports = function(grunt) {

// Project configuration.
grunt.initConfig({
// Metadata.
pkg: grunt.file.readJSON('package.json'),
banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
'<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
// Task configuration.
distFileName: '<%= pkg.name %>-<%= pkg.version %>',
concat: {
options: {
banner: '<%= banner %>',
stripBanners: true,
separator: ';'
},
dist: {
src: [
'src/browser.js',
'src/lang/*.js',
'src/dom/*.js',
'src/quirks/*.js',
'src/selection/*.js',
'src/commands.js',
'src/commands/*.js',
'src/undo_manager.js',
'src/views/*.js',
'src/toolbar/*.js',
'src/editor.js'
],
dest: 'dist/<%= distFileName %>.js'
},
},
uglify: {
options: '<%= concat.options %>',
dist: {
src: '<%= concat.dist.src %>',
dest: 'dist/<%= distFileName %>.min.js'
},
},
nodeunit: {
files: ['test/**/*_test.js']
},
watch: {
test: {
files: ['test/*.js', 'test/*/*.js', 'test/*.html'],
tasks: ['qunit']
},
},
qunit: {
options: {
timeout: 10000,
'--cookies-file': 'misc/cookies.txt'
},
all: ['test/*.html']
}
});

grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-nodeunit');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-qunit');

grunt.registerTask('build', ['concat', 'uglify']);

};
97 changes: 0 additions & 97 deletions Makefile

This file was deleted.

82 changes: 0 additions & 82 deletions build/minify.js

This file was deleted.

40 changes: 40 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "wysihtml5",
"description": "advanced wysihtml5",
"version": "0.5.0pre",
"homepage": "https://github.com/winsonwq/wysihtml5",
"author": {
"name": "Wang Qiu",
"email": "[email protected]"
},
"repository": {
"type": "git",
"url": "git://github.com/winsonwq/wysihtml5.git"
},
"bugs": {
"url": "https://github.com/winsonwq/wysihtml5/issues"
},
"licenses": [
{
"type": "MIT",
"url": "https://github.com/winsonwq/wysihtml5/blob/master/LICENSE"
}
],
"main": "lib/wysihtml5",
"engines": {
"node": ">= 0.6.0"
},
"scripts": {
"test": "grunt nodeunit"
},
"devDependencies": {
"grunt-contrib-qunit": "~0.2.1",
"grunt-contrib-concat": "~0.1.2",
"grunt-contrib-uglify": "~0.1.1",
"grunt-contrib-jshint": "~0.1.1",
"grunt-contrib-nodeunit": "~0.1.2",
"grunt-contrib-watch": "~0.2.0",
"grunt": "~0.4.1"
},
"keywords": []
}
12 changes: 9 additions & 3 deletions test/dom/sandbox_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,9 @@ asyncTest("Check insertion of single stylesheet", function() {
new wysihtml5.dom.Sandbox(function(sandbox) {
var doc = sandbox.getDocument();
equal(doc.getElementsByTagName("link").length, 1, "Correct amount of stylesheets inserted into the dom tree");
start();
setTimeout(function(){
start();
}, 2000);
}, {
stylesheets: "https://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/blitzer/jquery-ui.css"
}).insertInto(document.body);
Expand All @@ -161,7 +163,9 @@ asyncTest("Check insertion of multiple stylesheets", function() {
new wysihtml5.dom.Sandbox(function(sandbox) {
var doc = sandbox.getDocument();
equal(doc.getElementsByTagName("link").length, 2, "Correct amount of stylesheets inserted into the dom tree");
start();
setTimeout(function(){
start();
}, 2000);
}, {
stylesheets: [
"https://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/blitzer/jquery-ui.css",
Expand All @@ -179,6 +183,8 @@ asyncTest("Check X-UA-Compatible", function() {
docMode = doc.documentMode;

ok(doc.documentMode === document.documentMode, "iFrame is in in the same document mode as the parent site");
start();
setTimeout(function() {
start();
}, 2000);
}).insertInto(document.body);
});
Loading