Permalink
Browse files

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

  • Loading branch information...
1 parent 7e9b8c0 commit 2a394feab305431dac72fa3071a5a08d60301ed4 lihongxun committed Apr 24, 2013
Showing with 758 additions and 639 deletions.
  1. +3 −0 .gitignore
  2. +3 −0 .jshintrc
  3. +87 −0 GruntFile.js
  4. +13 −0 README.md
  5. +318 −317 nv.d3.js
  6. +6 −5 nv.d3.min.js
  7. +11 −0 package.json
  8. +317 −317 src/models/indentedTree.js
View
@@ -22,3 +22,6 @@ _site
ehthumbs.db
Icon?
Thumbs.db
+# nodejs packages #
+######################
+node_modules
View
@@ -0,0 +1,3 @@
+{
+ "asi": true
+}
View
@@ -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']);
+};
View
@@ -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.
+## 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...
If you need to minify please build pull request in separate branch, and
merge and minify in your master.
Oops, something went wrong.

0 comments on commit 2a394fe

Please sign in to comment.