Commit 5b0fd53a authored by techird's avatar techird

build

parent 73d588ed
......@@ -3,5 +3,6 @@
*.sublime-project
*.sublime-workspace
dist/
release/
node_modules/
_drafts/
\ No newline at end of file
......@@ -8,6 +8,7 @@ module.exports = function(grunt) {
// These plugins provide necessary tasks.
/* [Build plugin & task ] ------------------------------------*/
grunt.loadNpmTasks('grunt-module-dependence');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
......@@ -22,12 +23,19 @@ module.exports = function(grunt) {
' * ====================================================\n' +
' */\n\n';
var expose = '\nuse(\'kityminder\');\n';
// Project configuration.
grunt.initConfig({
// Metadata.
pkg: grunt.file.readJSON('package.json'),
clean: {
last: 'release'
},
// resolve dependence
dependence: {
options: {
base: 'src',
......@@ -36,15 +44,39 @@ module.exports = function(grunt) {
merge: {
files: [{
src: 'src/**/*.js',
dest: 'release/kityminder.all.js'
dest: 'release/kityminder.core.js'
}]
}
},
// concat
concat: {
closure: {
options: {
banner: banner + '(function () {\n',
footer: expose + '})();'
},
files: {
'release/kityminder.core.js': ['release/kityminder.core.js']
}
}
},
uglify: {
options: {
banner: banner
},
minimize: {
files: {
'release/kityminder.core.min.js': 'release/kityminder.core.js'
}
}
}
});
// Build task(s).
grunt.registerTask('default', ['dependence']);
grunt.registerTask('default', ['clean', 'dependence', 'concat', 'uglify']);
};
\ No newline at end of file
......@@ -26,6 +26,8 @@
right: 210px;
}
</style>
<script type="text/javascript" src="lib/kity/dist/kity.min.js"></script>
</head>
<body>
<div id="minder-view"></div>
......@@ -51,12 +53,12 @@ seajs.use('start');
<!-- *********************** 打包文件引入(需要先 grunt 发布) ************************* -->
<!--
<script type="text/javascript" src="../release/kityminder.all.min.js">
<script type="text/javascript" src="../release/kityminder.core.min.js"></script>
<script type="text/javascript">
// 创建 km 实例
window.km = new kityminder.Minder('minder-view');
window.km = new kityminder.Minder({
renderTo: 'minder-view'
});
</script>
-->
</html>
\ No newline at end of file
Subproject commit 37bf46da77a793cba3dde1a78dd83918c12f94ae
Subproject commit 2b98770cf42c20cdc863b95b40911943baa20453
......@@ -7,5 +7,5 @@
* @copyright: Baidu FEX, 2014
*/
define(function(require, exports, module) {
module.exports = require('../../lib/kity/src/kity.js');
module.exports = window.kity;
});
\ No newline at end of file
define(function(require, exports) {
var kity = require('../../lib/kity/src/kity.js');
var kity = require('./kity.js');
var uuidMap = {};
exports.extend = kity.Utils.extend.bind(kity.Utils);
......
......@@ -8,13 +8,12 @@
*/
define(function(require, exports, module) {
define('kityminder', function(require, exports, module) {
var kityminder = {
version: require('core/minder').version
};
// 核心导出,大写的部分导出类,小写的部分简单 require 一下
require('core/kity');
require('core/utils');
kityminder.Minder = require('core/minder');
kityminder.Command = require('core/command');
......@@ -85,5 +84,5 @@ define(function(require, exports, module) {
require('template/right');
require('template/fish-bone');
module.exports = kityminder;
module.exports = window.kityminder = kityminder;
});
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment