mirror of
https://github.com/chartjs/Chart.js.git
synced 2026-03-07 00:36:50 +01:00
10
gulpfile.js
10
gulpfile.js
@@ -13,7 +13,8 @@ var gulp = require('gulp'),
|
||||
fs = require('fs'),
|
||||
package = require('./package.json'),
|
||||
bower = require('./bower.json'),
|
||||
karma = require('gulp-karma');
|
||||
karma = require('gulp-karma'),
|
||||
umd = require('gulp-umd');
|
||||
|
||||
var srcDir = './src/';
|
||||
var testDir = './test/';
|
||||
@@ -72,6 +73,13 @@ function buildTask() {
|
||||
return gulp.src(srcFiles)
|
||||
.pipe(concat('Chart.js'))
|
||||
.pipe(replace('{{ version }}', package.version))
|
||||
.pipe(umd({
|
||||
// We want a global always to ensure that we match previous behaviour
|
||||
templateName: 'returnExportsGlobal',
|
||||
dependencies: function() {
|
||||
return ['moment']
|
||||
}
|
||||
}))
|
||||
.pipe(gulp.dest(outputDir))
|
||||
.pipe(uglify({
|
||||
preserveComments: 'some'
|
||||
|
||||
@@ -30,7 +30,8 @@
|
||||
"karma-firefox-launcher": "^0.1.6",
|
||||
"karma-jasmine": "^0.3.6",
|
||||
"karma-jasmine-html-reporter": "^0.1.8",
|
||||
"semver": "^3.0.1"
|
||||
"semver": "^3.0.1",
|
||||
"gulp-umd": "~0.2.0"
|
||||
},
|
||||
"spm": {
|
||||
"main": "Chart.js"
|
||||
|
||||
@@ -246,9 +246,10 @@
|
||||
})(),
|
||||
warn = helpers.warn = function(str) {
|
||||
//Method for warning of errors
|
||||
if (window.console && typeof window.console.warn === "function") console.warn(str);
|
||||
if (console && typeof console.warn === "function") {
|
||||
console.warn(str);
|
||||
}
|
||||
},
|
||||
amd = helpers.amd = (typeof define === 'function' && define.amd),
|
||||
//-- Math methods
|
||||
isNumber = helpers.isNumber = function(n) {
|
||||
return !isNaN(parseFloat(n)) && isFinite(n);
|
||||
@@ -787,11 +788,11 @@
|
||||
ctx.closePath();
|
||||
},
|
||||
color = helpers.color = function(color) {
|
||||
if (!window.Color) {
|
||||
if (!root.Color) {
|
||||
console.log('Color.js not found!');
|
||||
return color;
|
||||
}
|
||||
return window.Color(color);
|
||||
return root.Color(color);
|
||||
},
|
||||
addResizeListener = helpers.addResizeListener = function(node, callback) {
|
||||
// Hide an iframe before the node
|
||||
|
||||
@@ -109,14 +109,6 @@
|
||||
},
|
||||
};
|
||||
|
||||
if (typeof amd !== 'undefined') {
|
||||
define(function() {
|
||||
return Chart;
|
||||
});
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
module.exports = Chart;
|
||||
}
|
||||
|
||||
root.Chart = Chart;
|
||||
|
||||
Chart.noConflict = function() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
(function() {
|
||||
(function(moment) {
|
||||
"use strict";
|
||||
|
||||
if (!window.moment) {
|
||||
if (!moment) {
|
||||
console.warn('Chart.js - Moment.js could not be found! You must include it before Chart.js to use the time scale. Download at http://momentjs.com/');
|
||||
return;
|
||||
}
|
||||
@@ -277,4 +277,4 @@
|
||||
});
|
||||
Chart.scaleService.registerScaleType("time", TimeScale, defaultConfig);
|
||||
|
||||
}).call(this);
|
||||
}).call(this, moment);
|
||||
|
||||
Reference in New Issue
Block a user