Replaced custom make with Grunt build system. Closes gh-717.
This commit is contained in:
parent
a79f8ec2fd
commit
5a23713f86
|
|
@ -0,0 +1,39 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
module.exports = function(grunt) {
|
||||||
|
|
||||||
|
// Project configuration.
|
||||||
|
grunt.initConfig({
|
||||||
|
// Metadata.
|
||||||
|
pkg: grunt.file.readJSON('package.json'),
|
||||||
|
banner: grunt.file.read('copy.js'),
|
||||||
|
// Task configuration.
|
||||||
|
concat: {
|
||||||
|
options: {
|
||||||
|
banner: '<%= banner %>',
|
||||||
|
stripBanners: true
|
||||||
|
},
|
||||||
|
dist: {
|
||||||
|
src: ['./eve/eve.js', 'raphael.core.js', 'raphael.svg.js', 'raphael.vml.js'],
|
||||||
|
dest: '<%= pkg.name %>.js'
|
||||||
|
},
|
||||||
|
},
|
||||||
|
uglify: {
|
||||||
|
options: {
|
||||||
|
banner: '<%= banner %>'
|
||||||
|
},
|
||||||
|
dist: {
|
||||||
|
src: '<%= concat.dist.dest %>',
|
||||||
|
dest: '<%= pkg.name %>-min.js'
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// These plugins provide necessary tasks.
|
||||||
|
grunt.loadNpmTasks('grunt-contrib-concat');
|
||||||
|
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||||
|
|
||||||
|
|
||||||
|
// Default task.
|
||||||
|
grunt.registerTask('default', ['concat', 'uglify']);
|
||||||
|
};
|
||||||
|
|
@ -9,6 +9,7 @@ Visit the library website for more information: [http://raphaeljs.com](http://ra
|
||||||
(thank you [Wes Tood](https://github.com/wesleytodd))
|
(thank you [Wes Tood](https://github.com/wesleytodd))
|
||||||
|
|
||||||
## Dependencies
|
## Dependencies
|
||||||
|
* [grunt](https://github.com/gruntjs/grunt)
|
||||||
* [uglifyjs](https://github.com/mishoo/UglifyJS)
|
* [uglifyjs](https://github.com/mishoo/UglifyJS)
|
||||||
* [eve](https://github.com/adobe-webplatform/eve)
|
* [eve](https://github.com/adobe-webplatform/eve)
|
||||||
|
|
||||||
|
|
@ -52,7 +53,7 @@ We are organizing the current issues between this milestones, setting the ground
|
||||||
|
|
||||||
All changes in code must go to `raphael.core`, `raphael.svg` or `raphael.vml`. `raphael.js` is a generated file.
|
All changes in code must go to `raphael.core`, `raphael.svg` or `raphael.vml`. `raphael.js` is a generated file.
|
||||||
|
|
||||||
After adding your changes, execute `./make`, the minified version will be created, commit and you are ready to make a pull request!
|
After adding your changes, execute `grunt`, the minified version will be created, commit and you are ready to make a pull request!
|
||||||
|
|
||||||
## Found an issue?
|
## Found an issue?
|
||||||
|
|
||||||
|
|
|
||||||
2
copy.js
2
copy.js
|
|
@ -5,4 +5,4 @@
|
||||||
// │ Copyright © 2008-2012 Sencha Labs (http://sencha.com) │ \\
|
// │ Copyright © 2008-2012 Sencha Labs (http://sencha.com) │ \\
|
||||||
// ├────────────────────────────────────────────────────────────────────┤ \\
|
// ├────────────────────────────────────────────────────────────────────┤ \\
|
||||||
// │ Licensed under the MIT (http://raphaeljs.com/license.html) license.│ \\
|
// │ Licensed under the MIT (http://raphaeljs.com/license.html) license.│ \\
|
||||||
// └────────────────────────────────────────────────────────────────────┘ \\
|
// └────────────────────────────────────────────────────────────────────┘ \\
|
||||||
|
|
|
||||||
44
make
44
make
|
|
@ -1,44 +0,0 @@
|
||||||
#!/usr/bin/env node
|
|
||||||
var ujs = require('uglify-js'),
|
|
||||||
fs = require('fs'),
|
|
||||||
input = {
|
|
||||||
core : 'raphael.core.js',
|
|
||||||
svg : 'raphael.svg.js',
|
|
||||||
vml : 'raphael.vml.js',
|
|
||||||
eve : './eve/eve.js',
|
|
||||||
copy : 'copy.js'
|
|
||||||
},
|
|
||||||
output = {
|
|
||||||
'raphael-min.js' : ['eve', 'core', 'svg', 'vml'],
|
|
||||||
'raphael.js' : ['eve', 'core', 'svg', 'vml']
|
|
||||||
};
|
|
||||||
|
|
||||||
for (var file in input) {
|
|
||||||
input[file] = fs.readFileSync(input[file], 'utf8');
|
|
||||||
}
|
|
||||||
for (file in output) {
|
|
||||||
var out = '';
|
|
||||||
if (file.indexOf('min') !== -1) {
|
|
||||||
console.log('Compressing ' + file);
|
|
||||||
for (var i = 0, l = output[file].length; i < l; i++) {
|
|
||||||
var o = ujs.minify(input[output[file][i]], {
|
|
||||||
fromString : true
|
|
||||||
});
|
|
||||||
out += o.code;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
console.log('Concatinating ' + file);
|
|
||||||
for (i = 0, l = output[file].length; i < l; i++) {
|
|
||||||
out += input[output[file][i]] + '\n';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
(function(f, code){
|
|
||||||
fs.writeFile(f, input.copy + '\n' + code, function(err) {
|
|
||||||
if (err) {
|
|
||||||
console.log(err);
|
|
||||||
} else {
|
|
||||||
console.log('Saved to \033[32m' + f + '\033[0m\n');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
})(file, out);
|
|
||||||
}
|
|
||||||
|
|
@ -15,6 +15,9 @@
|
||||||
"readmeFilename": "README.markdown",
|
"readmeFilename": "README.markdown",
|
||||||
"gitHead": "52bff469f60988f1391e8b3d7cb5349163df8ba1",
|
"gitHead": "52bff469f60988f1391e8b3d7cb5349163df8ba1",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"uglify-js": "~2.2.3"
|
"grunt-cli": "~0.1.7",
|
||||||
|
"grunt": "~0.4.1",
|
||||||
|
"grunt-contrib-uglify": "~0.2.0",
|
||||||
|
"grunt-contrib-concat": "~0.3.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue