Skip to content

Commit 266328b

Browse files
committed
Merge pull request #18 from CSNW/update-legend
Update legend, build, and styling
2 parents 075ce8d + af8eea3 commit 266328b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+6323
-2671
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ bower_components
33
.grunt
44
specs/index.html
55
npm-debug.log
6-
example/data
76
tmp/
87

98
_site/
109
.sass-cache
10+
_tasks/
1111

1212
# OS Junk
1313
Thumbs.db

Gruntfile.js

Lines changed: 148 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,183 @@
11
module.exports = function(grunt) {
2-
// load-grunt-config does the following automatically
3-
// - load tasks/options into config
4-
// - load grunt-* npm tasks in package.json
5-
var config = require('load-grunt-config')(grunt, {
6-
configPath: require('path').join(process.cwd(), 'tasks/options'),
7-
init: false,
8-
loadGruntTasks: {
9-
pattern: 'grunt-*',
10-
config: require('./package.json'),
11-
scope: 'devDependencies'
12-
}
13-
});
2+
require('load-grunt-tasks')(grunt);
143

15-
config.env = process.env;
16-
config.pkg = grunt.file.readJSON('package.json');
17-
config.meta = {
18-
banner: '/*! <%= pkg.name %> - v<%= pkg.version %>\n' +
19-
' * <%= pkg.homepage %>\n' +
20-
' * License: <%= pkg.license %>\n' +
21-
' */\n',
22-
srcFiles: [
23-
// core
4+
var src = {
5+
core: [
246
'src/helpers.js',
257
'src/Base.js',
268
'src/Chart.js',
279
'src/Component.js',
28-
'src/Multi.js',
29-
30-
// mixins
31-
'src/mixins.js',
32-
33-
// library
34-
'src/charts/XYLabels.js',
10+
'src/Multi.js'
11+
],
12+
mixins: [
13+
'src/mixins.js'
14+
],
15+
lib: [
16+
'src/charts/Labels.js',
3517
'src/charts/Bars.js',
3618
'src/charts/Line.js',
3719
'src/components/Title.js',
3820
'src/components/Axis.js',
3921
'src/components/Legend.js',
4022
'src/extensions/xy.js'
23+
],
24+
css: [
25+
'src/css/base.css'
4126
]
4227
};
43-
grunt.initConfig(config);
4428

45-
grunt.loadTasks('tasks');
46-
this.registerTask('default', ['test']);
29+
grunt.initConfig({
30+
env: process.env,
31+
pkg: grunt.file.readJSON('package.json'),
32+
meta: {
33+
banner: '/*! <%= pkg.name %> - v<%= pkg.version %>\n' +
34+
' * <%= pkg.homepage %>\n' +
35+
' * License: <%= pkg.license %>\n' +
36+
' */\n',
37+
src: src
38+
},
39+
40+
concat: {
41+
temp: {
42+
options: {
43+
sourceMap: true
44+
},
45+
files: {
46+
'tmp/<%= pkg.name %>.js': src.core,
47+
'tmp/<%= pkg.name %>-mixins.js': src.core.concat(src.mixins),
48+
'tmp/<%= pkg.name %>-all.js': src.core.concat(src.mixins, src.lib),
49+
'tmp/<%= pkg.name %>.css': src.css
50+
}
51+
},
52+
release: {
53+
options: {
54+
banner: '<%= meta.banner %>'
55+
},
56+
files: {
57+
'dist/<%= pkg.name %>.js': src.core,
58+
'dist/<%= pkg.name %>-mixins.js': src.core.concat(src.mixins),
59+
'dist/<%= pkg.name %>-all.js': src.core.concat(src.mixins, src.lib),
60+
'dist/<%= pkg.name %>.css': src.css
61+
}
62+
}
63+
},
64+
65+
connect: {
66+
example: {
67+
options: {
68+
port: 4001,
69+
base: ['.', 'example'],
70+
open: true,
71+
hostname: 'localhost'
72+
}
73+
}
74+
},
75+
76+
jasmine: {
77+
options: {
78+
specs: ['specs/**/*.spec.js'],
79+
helpers: [
80+
'bower_components/jquery/dist/jquery.js',
81+
'bower_components/jasmine-jquery/lib/jasmine-jquery.js'
82+
],
83+
vendor: [
84+
'bower_components/d3/d3.js',
85+
'bower_components/underscore/underscore.js',
86+
'bower_components/d3.chart/d3.chart.js'
87+
]
88+
},
89+
90+
temp: {
91+
src: 'tmp/<%= pkg.name %>-mixins.js',
92+
options: {
93+
outfile: 'specs/index.html',
94+
keepRunner: true
95+
}
96+
},
97+
release: {
98+
src: 'dist/<%= pkg.name %>-mixins.js',
99+
options: {
100+
outfile: 'specs/index.html',
101+
keepRunner: false
102+
}
103+
}
104+
},
105+
106+
jshint: {
107+
options: {
108+
'jshintrc': '.jshintrc'
109+
},
110+
111+
src: ['src/**/*.js'],
112+
specs: ['specs/*.spec.js'],
113+
temp: ['tmp/<%= pkg.name %>-all.js'],
114+
release: ['dist/<%= pkg.name %>-all.js'],
115+
grunt: ['Gruntfile.js']
116+
},
47117

48-
this.registerTask('build', 'Temp build of the library', [
49-
'concat:temp',
50-
'copy:temp'
118+
uglify: {
119+
options: {
120+
banner: '<%= meta.banner %>',
121+
sourceMap: true,
122+
mangle: {
123+
except: ['d3']
124+
}
125+
},
126+
release: {
127+
files: {
128+
'dist/<%= pkg.name %>.min.js': 'dist/<%= pkg.name %>.js',
129+
'dist/<%= pkg.name %>-mixins.min.js': 'dist/<%= pkg.name %>-mixins.js',
130+
'dist/<%= pkg.name %>-all.min.js': 'dist/<%= pkg.name %>-all.js'
131+
}
132+
}
133+
},
134+
135+
watch: {
136+
jshint: {
137+
files: ['src/**/*.js'],
138+
tasks: ['jshint:src']
139+
},
140+
test: {
141+
files: ['src/**/*.js', 'src/**/*.css', 'specs/**/*.js'],
142+
tasks: ['build', 'test']
143+
},
144+
build: {
145+
files: ['src/**/*.js', 'src/**/*.css'],
146+
tasks: ['build']
147+
}
148+
}
149+
});
150+
151+
grunt.registerTask('default', ['test']);
152+
153+
grunt.registerTask('build', 'Temp build of the library', [
154+
'concat:temp'
51155
]);
52156

53-
this.registerTask('build:release', 'Release build of the library', [
157+
grunt.registerTask('build:release', 'Release build of the library', [
54158
'concat:release',
55-
'uglify:release',
56-
'copy:release'
159+
'uglify:release'
57160
]);
58161

59-
this.registerTask('release', 'Builds a new release of the library', [
162+
grunt.registerTask('release', 'Builds a new release of the library', [
60163
'build:release',
61164
'jshint:release',
62165
'jasmine:release'
63166
]);
64-
65-
this.registerTask('test', 'Lint and run specs', [
167+
168+
grunt.registerTask('test', 'Lint and run specs', [
66169
'jshint:src',
67170
'jshint:specs',
68171
'jasmine:temp'
69172
]);
70173

71-
this.registerTask('server', 'Run example (at http://localhost:4001)', [
72-
'connect:example:keepalive'
174+
grunt.registerTask('serve', 'Run example with automatic build', [
175+
'connect:example',
176+
'watch:build'
73177
]);
74178

75-
this.registerTask('debug', 'Run example with automatic build', [
179+
grunt.registerTask('debug', 'Run example with automatic build and testing', [
76180
'connect:example',
77-
'watch:build'
181+
'watch:test'
78182
]);
79183
};

dist/css/d3.chart.multi.base.css

Lines changed: 0 additions & 76 deletions
This file was deleted.

0 commit comments

Comments
 (0)