add grunt, see more in README.md about how to use intstall and use grunt

master-patched
lihongxun 11 years ago
parent 7e9b8c013c
commit 2a394feab3

3
.gitignore vendored

@ -22,3 +22,6 @@ _site
ehthumbs.db ehthumbs.db
Icon? Icon?
Thumbs.db Thumbs.db
# nodejs packages #
######################
node_modules

@ -0,0 +1,3 @@
{
"asi": true
}

@ -0,0 +1,87 @@
module.exports = function(grunt) {
//Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
options: {
separator: ''
},
dist: {
src: [
'src/intro.js',
'src/core.js',
'src/tooltip.js',
'src/utils.js',
'src/models/axis.js',
'src/models/historicalBar.js',
'src/models/bullet.js',
'src/models/bulletChart.js',
'src/models/cumulativeLineChart.js',
'src/models/discreteBar.js',
'src/models/discreteBarChart.js',
'src/models/distribution.js',
'src/models/indentedTree.js',
'src/models/legend.js',
'src/models/line.js',
'src/models/lineChart.js',
'src/models/linePlusBarChart.js',
'src/models/lineWithFocusChart.js',
'src/models/linePlusBarWithFocusChart.js',
'src/models/multiBar.js',
'src/models/multiBarChart.js',
'src/models/multiBarHorizontal.js',
'src/models/multiBarHorizontalChart.js',
'src/models/multiChart.js',
'src/models/ohlcBar.js',
'src/models/pie.js',
'src/models/pieChart.js',
'src/models/scatter.js',
'src/models/scatterChart.js',
'src/models/scatterPlusLineChart.js',
'src/models/sparkline.js',
'src/models/sparklinePlus.js',
'src/models/stackedArea.js',
'src/models/stackedAreaChart.js',
'src/outro.js'
],
dest: 'nv.d3.js'
}
},
uglify: {
options: {
banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %> */'
},
js: {
files: {
'nv.d3.min.js': ['nv.d3.js']
}
}
},
jshint: {
foo: {
src: "src/**/*.js"
},
options: {
jshintrc: '.jshintrc'
}
},
watch: {
js: {
files: ["src/**/*.js"],
tasks: ['concat']
}
},
});
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.registerTask('default', ['concat']);
grunt.registerTask('production', ['concat', 'uglify']);
grunt.registerTask('lint', ['jshint']);
};

@ -41,6 +41,19 @@ fork's root directory will rebuild both `nv.d3.js` and `nv.d3.min.js`.
Without UglifyJS, you won't get the minified version when running make. Without UglifyJS, you won't get the minified version when running make.
## use grunt
You can use grunt insteadof makefile to build js file. See more about [grunt](http://gruntjs.com/).
***[Nodejs](http://nodejs.org/) must be installed before you can use grunt.***
Run `npm install` in root dir to install grunt and it's dependencies.
Then, you can use these commands:
grunt # build nv.d3.js
grunt production # build nv.d3.js and nv.d3.min.js
grunt watch # watch file changes in src/, and rebuild nv.d3.js, it's very helpful when delevop nvd3
grunt lint # run jshint on src/**/*.js
**We ask that you DO NOT minify pull requests... **We ask that you DO NOT minify pull requests...
If you need to minify please build pull request in separate branch, and If you need to minify please build pull request in separate branch, and
merge and minify in your master. merge and minify in your master.

@ -3463,7 +3463,8 @@ nv.models.indentedTree = function() {
return chart; return chart;
};nv.models.legend = function() { };
nv.models.legend = function() {
//============================================================ //============================================================
// Public Variables with Default Settings // Public Variables with Default Settings

11
nv.d3.min.js vendored

File diff suppressed because one or more lines are too long

@ -0,0 +1,11 @@
{
"name": "nvd3",
"version": "0.0.1",
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-jshint": "~0.3.0",
"grunt-contrib-watch": "~0.3.1",
"grunt-contrib-uglify": "~0.2.0",
"grunt-contrib-concat": "~0.2.0"
}
}
Loading…
Cancel
Save