Added minified JS, fixed banners, and updated readme with documentation on how to work with source files and use gulp tasks

This commit is contained in:
David Miller 2016-06-23 16:22:57 -04:00
parent cee1a3605e
commit a76ba7512e
6 changed files with 40 additions and 15 deletions

View File

@ -4,11 +4,21 @@
## Getting Started ## Getting Started
To begin using this template, choose one of the following options to get started: Several options are available to get started quickly:
* [Download the latest release on Start Bootstrap](http://startbootstrap.com/template-overviews/agency/) * [Download the latest release on Start Bootstrap](http://startbootstrap.com/template-overviews/agency/)
* Clone the repo: `git clone https://github.com/BlackrockDigital/startbootstrap-agency.git` * Clone the repo: `git clone https://github.com/BlackrockDigital/startbootstrap-agency.git`
* Fork the repo * Fork the repo
## Using Source Files
To use the source files, you will need to have npm installed globally along with Gulp.js. To start:
* Run `npm install` in the root directory
* Run `gulp dev` and edit the files as needed
If you need to update the plugins included with this template, simpy run the following tasks:
* First run `npm update` to update the dependencies
* Then run `gulp copy` to copy the new versions to their proper destinations
## Bugs and Issues ## Bugs and Issues
Have a bug or an issue with this template? [Open a new issue](https://github.com/BlackrockDigital/startbootstrap-agency/issues) here on GitHub or leave a comment on the [template overview page at Start Bootstrap](http://startbootstrap.com/template-overviews/agency/). Have a bug or an issue with this template? [Open a new issue](https://github.com/BlackrockDigital/startbootstrap-agency/issues) here on GitHub or leave a comment on the [template overview page at Start Bootstrap](http://startbootstrap.com/template-overviews/agency/).

View File

@ -5,6 +5,7 @@ var browserSync = require('browser-sync').create();
var header = require('gulp-header'); var header = require('gulp-header');
var cleanCSS = require('gulp-clean-css'); var cleanCSS = require('gulp-clean-css');
var rename = require("gulp-rename"); var rename = require("gulp-rename");
var uglify = require('gulp-uglify');
var pkg = require('./package.json'); var pkg = require('./package.json');
// Set the banner content // Set the banner content
@ -36,26 +37,38 @@ gulp.task('less', function() {
gulp.task('minify-css', function() { gulp.task('minify-css', function() {
return gulp.src('css/agency.css') return gulp.src('css/agency.css')
.pipe(cleanCSS({ compatibility: 'ie8' })) .pipe(cleanCSS({ compatibility: 'ie8' }))
.pipe(rename({suffix: '.min'})) .pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest('css')) .pipe(gulp.dest('css'))
.pipe(browserSync.reload({ .pipe(browserSync.reload({
stream: true stream: true
})) }))
}); });
// Grab Bootstrap core files from node_modules // Minify JS
gulp.task('minify-js', function() {
return gulp.src('js/agency.js')
.pipe(uglify())
.pipe(header(banner, { pkg: pkg }))
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest('js'))
.pipe(browserSync.reload({
stream: true
}))
});
// Copy Bootstrap core files from node_modules
gulp.task('bootstrap', function() { gulp.task('bootstrap', function() {
return gulp.src(['node_modules/bootstrap/dist/**/*', '!**/npm.js', '!**/bootstrap-theme.*', '!**/*.map']) return gulp.src(['node_modules/bootstrap/dist/**/*', '!**/npm.js', '!**/bootstrap-theme.*', '!**/*.map'])
.pipe(gulp.dest('')) .pipe(gulp.dest(''))
}) })
// Grab jQuery core files from node_modules // Copy jQuery core files from node_modules
gulp.task('jquery', function() { gulp.task('jquery', function() {
return gulp.src(['node_modules/jquery/dist/jquery.js', 'node_modules/jquery/dist/jquery.min.js']) return gulp.src(['node_modules/jquery/dist/jquery.js', 'node_modules/jquery/dist/jquery.min.js'])
.pipe(gulp.dest('js')) .pipe(gulp.dest('js'))
}) })
// Grab Font Awesome core files from node_modules // Copy Font Awesome core files from node_modules
gulp.task('fontawesome', function() { gulp.task('fontawesome', function() {
return gulp.src([ return gulp.src([
'node_modules/font-awesome/**', 'node_modules/font-awesome/**',
@ -68,8 +81,8 @@ gulp.task('fontawesome', function() {
.pipe(gulp.dest('font-awesome')) .pipe(gulp.dest('font-awesome'))
}) })
// Updates all dependencies and puts them into their proper destinations // Copy all dependencies from node_modules
gulp.task('update', ['bootstrap', 'jquery', 'fontawesome']); gulp.task('copy', ['bootstrap', 'jquery', 'fontawesome']);
// Configure the browserSync task // Configure the browserSync task
gulp.task('browserSync', function() { gulp.task('browserSync', function() {
@ -81,9 +94,10 @@ gulp.task('browserSync', function() {
}) })
// Watch Task that compiles LESS and watches for HTML or JS changes and reloads with browserSync // Watch Task that compiles LESS and watches for HTML or JS changes and reloads with browserSync
gulp.task('watch', ['browserSync', 'less', 'minify-css'], function() { gulp.task('dev', ['browserSync', 'less', 'minify-css', 'minify-js'], function() {
gulp.watch('less/*.less', ['less']); gulp.watch('less/*.less', ['less']);
gulp.watch('css/*.css', ['minify-css']); gulp.watch('css/*.css', ['minify-css']);
gulp.watch('js/*.js', ['minify-js']);
// Reloads the browser whenever HTML or JS files change // Reloads the browser whenever HTML or JS files change
gulp.watch('*.html', browserSync.reload); gulp.watch('*.html', browserSync.reload);
gulp.watch('js/**/*.js', browserSync.reload); gulp.watch('js/**/*.js', browserSync.reload);

View File

@ -446,7 +446,7 @@
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-md-4"> <div class="col-md-4">
<span class="copyright">Copyright &copy; Your Website 2014</span> <span class="copyright">Copyright &copy; Your Website 2016</span>
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
<ul class="list-inline social-buttons"> <ul class="list-inline social-buttons">

View File

@ -1,9 +1,3 @@
/*!
* Agency v1.0.x (http://startbootstrap.com/template-overviews/agency)
* Copyright 2013-2016 Start Bootstrap
* Licensed under MIT (https://github.com/BlackrockDigital/startbootstrap/blob/gh-pages/LICENSE)
*/
(function($) { (function($) {
"use strict"; // Start of use strict "use strict"; // Start of use strict

6
js/agency.min.js vendored Normal file
View File

@ -0,0 +1,6 @@
/*!
* Start Bootstrap - Agency v1.0.7 (http://startbootstrap.com/template-overviews/agency)
* Copyright 2013-2016 Start Bootstrap
* Licensed under MIT (https://github.com/BlackrockDigital/startbootstrap/blob/gh-pages/LICENSE)
*/
!function(t){"use strict";t("a.page-scroll").bind("click",function(o){var a=t(this);t("html, body").stop().animate({scrollTop:t(a.attr("href")).offset().top-50},1250,"easeInOutExpo"),o.preventDefault()}),t("body").scrollspy({target:".navbar-fixed-top",offset:51}),t(".navbar-collapse ul li a:not(.dropdown-toggle)").click(function(){t(".navbar-toggle:visible").click()}),t("#mainNav").affix({offset:{top:100}})}(jQuery);

View File

@ -19,6 +19,7 @@
"gulp-header": "^1.8.7", "gulp-header": "^1.8.7",
"gulp-less": "^3.1.0", "gulp-less": "^3.1.0",
"gulp-rename": "^1.2.2", "gulp-rename": "^1.2.2",
"gulp-uglify": "^1.5.4",
"jquery": "^1.11.3" "jquery": "^1.11.3"
}, },
"repository": { "repository": {