forked from speced/respec
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request speced#233 from blazkovicz/gulp-tasks
Gulp tasks for checking and building js
- Loading branch information
Showing
3 changed files
with
81 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
// Gulp and plugins | ||
var | ||
gulp = require('gulp'), | ||
rimraf = require('gulp-rimraf'), | ||
uglify = require('gulp-uglify'), | ||
concat = require('gulp-concat'), | ||
rename = require('gulp-rename'), | ||
//sass = require('gulp-sass'), // for building css from scss | ||
//minifycss = require('gulp-minify-css'), // for minifiing css | ||
jslint = require('gulp-jslint'); | ||
|
||
// paths | ||
var | ||
src = './src/', | ||
//scss = './scss/', | ||
//scssFiles = [], | ||
//scssDependencies = [], | ||
dist = './js/', | ||
jsFiles = [ | ||
src + 'common/data_graphic.js', | ||
src + 'common/chart_title.js', | ||
src + 'common/y_axis.js', | ||
src + 'common/x_axis.js', | ||
src + 'common/init.js', | ||
src + 'common/markers.js', | ||
src + 'layout/button.js', | ||
src + 'charts/line.js', | ||
src + 'charts/histogram.js', | ||
src + 'charts/point.js', | ||
src + 'charts/bar.js', | ||
src + 'charts/table.js', | ||
src + 'charts/missing.js', | ||
src + 'misc/process.js', | ||
src + 'misc/smoothers.js', | ||
src + 'misc/utility.js', | ||
src + 'misc/error.js' | ||
]; | ||
|
||
gulp.task('clean', function () { | ||
return gulp.src([dist + 'metricsgraphics.js', dist + 'metricsgraphics.min.js'], {read: false}) | ||
.pipe(rimraf()); | ||
}); | ||
|
||
// build css files from scss | ||
//gulp.task('build:css', ['clean'], function () { | ||
// return gulp.src(scssFiles) | ||
// .pipe(sass({includePaths: scssDependencies})) | ||
// .pipe(minifycss()) | ||
// .pipe(gulp.dest(dist)); | ||
//}); | ||
|
||
// create 'metricsgraphics.js' and 'metricsgraphics.min.js' from source js | ||
gulp.task('build:js', ['clean'], function () { | ||
return gulp.src(jsFiles) | ||
.pipe(concat('metricsgraphics.js')) | ||
.pipe(gulp.dest(dist)) | ||
.pipe(rename('metricsgraphics.min.js')) | ||
.pipe(uglify()) | ||
.pipe(gulp.dest(dist)); | ||
}); | ||
|
||
// check source js files with jslint | ||
gulp.task('jslint', function () { | ||
return gulp.src(jsFiles) | ||
.pipe(jslint({ | ||
predef: ["window", '$', 'd3'], // used globals | ||
nomen: false // true if there are variable names with leading _ | ||
})); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters