Commit 5b0fd53a authored by techird's avatar techird

build

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