Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/assets versioning #3

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ node_modules
.DS_Store
app/styles/styles.css
dist
rev-dist

# Vim
[._]*.s[a-w][a-z]
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ FROM nginx

COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY key.pem cert.pem /etc/nginx/ssl/
COPY dist /usr/share/nginx/html
COPY rev-dist /usr/share/nginx/html
Empty file removed app/styles/ie8.css
Empty file.
Empty file removed app/styles/ie9.css
Empty file.
63 changes: 46 additions & 17 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
//initialize all of our variables
var app, base, concat, directory, gulp, gutil, hostname, path, refresh, sass, uglify, imagemin, minifyCSS, del, browserSync, autoprefixer, gulpSequence, shell, sourceMaps, plumber;

var autoPrefixBrowserList = ['last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4'];

//load all of our dependencies
//add more here if you want to include more libraries
gulp = require('gulp');
gutil = require('gulp-util');
concat = require('gulp-concat');
uglify = require('gulp-uglify');
sass = require('gulp-sass');
sourceMaps = require('gulp-sourcemaps');
imagemin = require('gulp-imagemin');
minifyCSS = require('gulp-minify-css');
browserSync = require('browser-sync');
autoprefixer = require('gulp-autoprefixer');
gulpSequence = require('gulp-sequence').use(gulp);
shell = require('gulp-shell');
plumber = require('gulp-plumber');
var gulp = require('gulp');
var gutil = require('gulp-util');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var sass = require('gulp-sass');
var sourceMaps = require('gulp-sourcemaps');
var imagemin = require('gulp-imagemin');
var minifyCSS = require('gulp-minify-css');
var browserSync = require('browser-sync');
var autoprefixer = require('gulp-autoprefixer');
var gulpSequence = require('gulp-sequence').use(gulp);
var shell = require('gulp-shell');
var plumber = require('gulp-plumber');
var RevAll = require('gulp-rev-all');

gulp.task('browserSync', function() {
browserSync({
Expand Down Expand Up @@ -171,6 +169,37 @@ gulp.task('html-deploy', function() {
//prevent pipe breaking caused by errors from gulp plugins
.pipe(plumber())
.pipe(gulp.dest('dist/styles'));

});

var ignoreRev = [
/^\/favicon.ico$/g,
/(^|\/)\.[^\/\.]/g,
'README',
'.html',
'.xml',
'.txt',
'.jpg',
'.png',
'.gif',
'.ttf',
'.eot',
'.woff',
'.svg',
'.otf',
];

gulp.task('rev-assets', function(){
setTimeout(function(){
var revAll = new RevAll({
dontRenameFile: ignoreRev,
dontUpdateReference: ignoreRev,
});
gulp.src(['dist/**','dist/.**'])
.pipe(revAll.revision())
.pipe(gulp.dest('rev-dist'));
},1000);

});

//cleans our dist directory in case things got deleted
Expand Down Expand Up @@ -207,4 +236,4 @@ gulp.task('default', ['browserSync', 'scripts', 'styles'], function() {
});

//this is our deployment task, it will set everything for deployment-ready files
gulp.task('deploy', gulpSequence('clean', 'scaffold', ['scripts-deploy', 'styles-deploy', 'images-deploy'], 'html-deploy'));
gulp.task('deploy', gulpSequence('clean', 'scaffold', ['scripts-deploy', 'styles-deploy', 'images-deploy'], 'html-deploy', 'rev-assets'));
5 changes: 3 additions & 2 deletions package.json
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@
"gulp-concat": "^2.6.0",
"gulp-imagemin": "^2.3.0",
"gulp-minify-css": "^1.2.1",
"gulp-plumber": "^1.0.1",
"gulp-rev-all": "^0.8.24",
"gulp-sass": "^2.0.4",
"gulp-sequence": "^0.4.1",
"gulp-shell": "^0.5.0",
"gulp-sourcemaps": "^1.6.0",
"gulp-uglify": "^1.4.1",
"gulp-util": "^3.0.6",
"gulp-plumber": "^1.0.1"
"gulp-util": "^3.0.6"
}
}