Skip to content

Commit

Permalink
Merge branch master into 6.2-stable
Browse files Browse the repository at this point in the history
  • Loading branch information
gakimball committed Feb 26, 2016
2 parents c821394 + 7133ba8 commit 4c9530f
Show file tree
Hide file tree
Showing 16 changed files with 977 additions and 47 deletions.
3 changes: 3 additions & 0 deletions .bowerrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"directory": "bower_components"
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,4 @@ pizza/
data.json
npm-debug.log
foundation-docs
vendor
2 changes: 1 addition & 1 deletion .versions
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ [email protected]
[email protected]
[email protected]
[email protected]
zurb:[email protected].1
zurb:[email protected].2
167 changes: 167 additions & 0 deletions docs/assets/img/gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
var $ = require('gulp-load-plugins')();
var argv = require('yargs').argv;
var gulp = require('gulp');
var rimraf = require('rimraf');
var panini = require('panini');
var sequence = require('run-sequence');

// Check for --production flag
var isProduction = !!(argv.production);

// File paths to various assets are defined here.
var paths = {
assets: [
'src/assets/**/*',
'!src/assets/{!img,js,scss}/**/*'
],
downloads: [
'src/downloads/**/*.*'
],
sass: [
'bower_components/foundation-sites/scss'
],
javascript: [
'node_modules/jquery/dist/jquery.js',
'bower_components/foundation-sites/dist/foundation.js',
'bower_components/what-input/what-input.js',
'src/assets/js/**/*.js',
'bower_components/lodash/lodash.js',
'src/assets/js/app.js'
]
};

// Delete the "dist" folder
// This happens every time a build starts
gulp.task('clean', function(done) {
rimraf('./dist', done);
});

// Copy files out of the assets folder
// This task skips over the "img", "js", and "scss" folders, which are parsed separately
gulp.task('copy', function(done) {
gulp.src(paths.assets)
.pipe(gulp.dest('./dist/assets'));
});
gulp.task('downloads', function(done){
gulp.src('src/downloads/**/*.*')
.pipe(gulp.dest('./dist/downloads'));
done();
});

// Copy page templates into finished HTML files
gulp.task('pages', function() {
gulp.src('./src/pages/**/*.html')
.pipe(panini({
root: './src/pages/',
layouts: './src/layouts/',
partials: './src/partials/',
data: './src/data/'
}))
.pipe($.cacheBust({ type: 'MD5' }))
.pipe(gulp.dest('./dist'));
});

gulp.task('pages:reset', function() {
panini.refresh();
gulp.run('pages');
});

// Compile Sass into CSS
// In production, the CSS is compressed
gulp.task('sass', function() {
var uncss = $.if(isProduction, $.uncss({
html: ['src/**/*.html'],
ignore: [
new RegExp('^meta\..*'),
new RegExp('^\.is-.*')
]
}));

return gulp.src('./src/assets/scss/app.scss')
.pipe($.sass({
includePaths: paths.sass,
outputStyle: isProduction ? 'compressed' : 'nested'
})
.on('error', $.sass.logError))
.pipe($.autoprefixer({
browsers: ['last 2 versions', 'ie >= 9']
}))
// .pipe(uncss)
.pipe(gulp.dest('./dist/assets/css'));
});

// Combine JavaScript into one file
// In production, the file is minified
gulp.task('javascript', function() {
var uglify = $.if(isProduction, $.uglify({
mangle: false
})
.on('error', function (e) {
console.log(e);
}));

return gulp.src(paths.javascript)
.pipe($.concat('app.js'))
.pipe(uglify)
.pipe(gulp.dest('./dist/assets/js'));
});

// Compiles HTML templates into JST
gulp.task('jst', function() {
gulp.src('src/templates/*.html')
.pipe($.jstConcat('templates.js', {
renameKeys: ['^.*marketing/(src.*.html)$', '$1']
}))
.pipe(gulp.dest('dist/assets/js'));
});

// Copy images to the "dist" folder
// In production, the images are compressed
gulp.task('images', function() {
var imagemin = $.if(isProduction, $.imagemin({
progressive: true
}));

return gulp.src('./src/assets/img/**/*')
// .pipe(imagemin)
.pipe(gulp.dest('./dist/assets/img'));
});

// Deploy to the live server
gulp.task('deploy', ['build'], function() {
return gulp.src('./dist/**')
.pipe($.prompt.confirm('Make sure everything looks right before you deploy.'))
.pipe($.rsync({
root: './dist',
hostname: '[email protected]',
destination: '/home/deployer/sites/foundation-sites-6-marketing'
}));
});

// Build the "dist" folder by running all of the above tasks
gulp.task('build', function(done) {
sequence('clean', ['pages', 'sass', 'javascript', 'images', 'jst', 'downloads'], done);
});

// Start a server with LiveReload to preview the site in
gulp.task('server', ['build'], function() {
return gulp.src('./dist')
.pipe($.webserver({
host: 'localhost',
port: 8000,
livereload: true,
open: true
}));
});

// Build the site, run the server, and watch for file changes
gulp.task('default', ['build', 'server'], function() {
gulp.watch(paths.assets, ['copy']);
gulp.watch(['./src/pages/**/*.html'], ['pages']);
gulp.watch(['./src/{layouts,partials}/**/*.html'], ['pages:reset']);
gulp.watch(['./src/assets/scss/**/*.scss'], ['sass']);
gulp.watch(['./src/assets/js/**/*.js'], ['javascript']);
gulp.watch(['bower_components/foundation-sites/dist/foundation.js'], ['javascript']);
gulp.watch(['./src/assets/img/**/*'], ['images']);
gulp.watch(['./src/templates/**/*'], ['jst']);
});
Loading

0 comments on commit 4c9530f

Please sign in to comment.