From 67b3295922ac1fd530c7356546882637388563e2 Mon Sep 17 00:00:00 2001 From: WesTyler Date: Sat, 6 Feb 2016 13:35:02 -0600 Subject: [PATCH] Issue #248 Move bower_component js files to concatenated scripts.js file. Add gulp concatenate task. --- .gitignore | 1 + client/index.html | 15 +------------- gulpfile.js | 50 ++++++++++++++++++++++++++++++++--------------- package.json | 7 ++++++- 4 files changed, 42 insertions(+), 31 deletions(-) diff --git a/.gitignore b/.gitignore index 48f9597..87c5ab8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ node_modules bower_components +client/scripts.js .DS_Store server/config.js server/access.log diff --git a/client/index.html b/client/index.html index ef38c8c..afaf00d 100644 --- a/client/index.html +++ b/client/index.html @@ -2,22 +2,9 @@ m o d u l o - - - - - - - - - - + - - - - diff --git a/gulpfile.js b/gulpfile.js index 33f82d8..7308b79 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -5,26 +5,44 @@ // Dependencies // ----------------------------------------------------------------------------- -var gulp = require('gulp'); -var sass = require('gulp-sass'); -var sourcemaps = require('gulp-sourcemaps'); -var autoprefixer = require('gulp-autoprefixer'); -var sassdoc = require('sassdoc'); +var gulp = require('gulp'), + sass = require('gulp-sass'), + sourcemaps = require('gulp-sourcemaps'), + autoprefixer = require('gulp-autoprefixer'), + sassdoc = require('sassdoc'), + concat = require('gulp-concat'); // ----------------------------------------------------------------------------- // Configuration // ----------------------------------------------------------------------------- -var input = 'client/styles/*.scss'; -var output = 'client/'; -var sassOptions = { outputStyle: 'expanded' }; -var autoprefixerOptions = { browsers: ['last 2 versions', '> 5%', 'Firefox ESR'] }; -var sassdocOptions = { dest: 'dist/sassdoc' }; +var input = 'client/styles/*.scss', + output = 'client/', + sassOptions = { outputStyle: 'expanded' }, + autoprefixerOptions = { browsers: ['last 2 versions', '> 5%', 'Firefox ESR'] }, + sassdocOptions = { dest: 'dist/sassdoc' }, + bowerPath = './bower_components/', + bowerComponents = [ + bowerPath + 'underscore/underscore.js', + bowerPath + 'jquery/dist/jquery.js', + bowerPath + 'angular/angular.js', + bowerPath + 'angular-ui-router/release/angular-ui-router.js', + bowerPath + 'moment/moment.js', + bowerPath + 'bootstrap/dist/js/bootstrap.js', + bowerPath + 'd3/d3.js', + bowerPath + 'd3-tip/index.js', + bowerPath + 'angular-loading-bar/src/loading-bar.js', + bowerPath + 'zeroclipboard/dist/ZeroClipboard.js', + bowerPath + 'angular-sanitize/angular-sanitize.js', + bowerPath + 'showdown/dist/showdown.js', + bowerPath + 'ng-showdown/dist/ng-showdown.js', + bowerPath + 'angular-markdown-directive/markdown.js' + ]; // ----------------------------------------------------------------------------- -// Sass compilation +// Tasks // ----------------------------------------------------------------------------- gulp.task('sass', function () { @@ -37,11 +55,6 @@ gulp.task('sass', function () { .pipe(gulp.dest(output)); }); - -// ----------------------------------------------------------------------------- -// Sass documentation generation -// ----------------------------------------------------------------------------- - gulp.task('sassdoc', function () { return gulp .src(input) @@ -49,6 +62,11 @@ gulp.task('sassdoc', function () { .resume(); }); +gulp.task('concatenate', function() { + return gulp.src(bowerComponents) + .pipe(concat('scripts.js')) + .pipe(gulp.dest('./client/')); +}); // ----------------------------------------------------------------------------- // Watchers diff --git a/package.json b/package.json index 6240659..15f8565 100644 --- a/package.json +++ b/package.json @@ -49,6 +49,11 @@ "del": "^1.2.1", "gulp": "^3.9.0", "gulp-autoprefixer": "^2.3.1", - "gulp-sass": "^2.0.4" + "gulp-concat": "^2.6.0", + "gulp-minify-css": "^1.2.3", + "gulp-sass": "^2.0.4", + "gulp-uglifyjs": "^0.6.2", + "gulp-usemin": "^0.3.20", + "main-bower-files": "^2.11.1" } }