Skip to content

Commit

Permalink
updated to Foundation 6 and added ECMAScript 6 support with Babel. Fo…
Browse files Browse the repository at this point in the history
…undation 5 still supported.
  • Loading branch information
dougmacklin committed Jan 20, 2016
1 parent e17f75d commit f80cea1
Show file tree
Hide file tree
Showing 11 changed files with 638 additions and 16,241 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

[Yeoman](http://yeoman.io) generator for [Zurb Foundation](http://foundation.zurb.com/) with:

* Foundation 6 (Foundation 5 option)
* Sass compiling (LibSass / Compass options)
* Browserify dependency bundling
* Gulp automation
* BrowserSync server with live reloading
* Babel for ECMAScript 6 ([2015 preset](http://babeljs.io/docs/plugins/preset-es2015/))
* Bourbon mixin library (option)
* Jade templating engine (option)
* Font Awesome (option)
Expand All @@ -32,7 +34,7 @@ Run `gulp` to start the server and watch for changes:
gulp
```

Include the `--prod` flag to export production-ready minified files (note: increases gulp task time, leave off for dev purposes):
Include the `--prod` flag to export production-ready minified files with ES2015 polyfills (note: increases gulp task time, leave off for dev purposes):
```
gulp --prod
```
Expand Down
28 changes: 25 additions & 3 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,21 @@ module.exports = yeoman.generators.Base.extend({
message: 'What is your project name?',
default: 'app-name'
},
{
type: 'confirm',
name: 'foundationVersion',
message: 'Would you like to use Foundation 6 (answer \'no\' for Foundation 5)',
default: true
},
{
when: function(response) {
return response.foundationVersion;
},
type: 'confirm',
name: 'flexbox',
message: 'Would you like to use the Flexbox-powered grid?',
default: true
},
{
type: 'confirm',
name: 'compass',
Expand Down Expand Up @@ -69,12 +84,19 @@ module.exports = yeoman.generators.Base.extend({
else
this.copy('_index.html', 'src/templates/index.html');

// sass files
// if using compass
if (this.props.compass)
this.copy('_config.rb', 'config.rb');

this.copy('_settings.scss', 'src/scss/_settings.scss');
this.copy('_app.scss', 'src/scss/app.scss');
// sass files for either foundation 6 or 5
if (this.props.foundationVersion) {
this.copy('_settings-foundation-6.scss', 'src/scss/_settings.scss');
this.copy('_app-foundation-6.scss', 'src/scss/app.scss');
}
else {
this.copy('_settings-foundation-5.scss', 'src/scss/_settings.scss');
this.copy('_app-foundation-5.scss', 'src/scss/app.scss');
}

this.copy('_main.js', 'src/js/main.js');
},
Expand Down
File renamed without changes.
43 changes: 43 additions & 0 deletions app/templates/_app-foundation-6.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
@charset 'UTF-8';

<% if (props.bourbon) { %>@import "bourbon";<% } %>
<% if (props.compass) { %>@import "compass/css3";<% } %>

@import 'settings';
@import '../../node_modules/foundation-sites/scss/foundation';

@include foundation-global-styles;
<% if (props.flexbox) { %>@include foundation-flex-grid;<% } else { %>@include foundation-grid;<% } %>
@include foundation-typography;
@include foundation-button;
@include foundation-forms;
@include foundation-visibility-classes;
@include foundation-float-classes;
@include foundation-accordion;
@include foundation-accordion-menu;
@include foundation-badge;
@include foundation-breadcrumbs;
@include foundation-button-group;
@include foundation-callout;
@include foundation-close-button;
@include foundation-drilldown-menu;
@include foundation-dropdown;
@include foundation-dropdown-menu;
@include foundation-flex-video;
@include foundation-label;
@include foundation-media-object;
@include foundation-menu;
@include foundation-off-canvas;
@include foundation-orbit;
@include foundation-pagination;
@include foundation-progress-bar;
@include foundation-slider;
@include foundation-sticky;
@include foundation-reveal;
@include foundation-switch;
@include foundation-table;
@include foundation-tabs;
@include foundation-thumbnail;
@include foundation-title-bar;
@include foundation-tooltip;
@include foundation-top-bar;
11 changes: 11 additions & 0 deletions app/templates/_gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ var browserSync = require('browser-sync');
var watchify = require('watchify');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var gulp = require('gulp');
var gutil = require('gulp-util');
var gulpSequence = require('gulp-sequence');
Expand All @@ -11,6 +12,9 @@ var watch = require('gulp-watch');
var minifycss = require('gulp-minify-css');
var uglify = require('gulp-uglify');
var streamify = require('gulp-streamify');
var sourcemaps = require('gulp-sourcemaps');
var concat = require('gulp-concat');
var babel = require('gulp-babel');
var prod = gutil.env.prod;

var onError = function(err) {
Expand All @@ -33,6 +37,13 @@ function bundle() {
return b.bundle()
.on('error', onError)
.pipe(source('bundle.js'))
.pipe(buffer())
.pipe(!prod ? sourcemaps.init() : gutil.noop())
.pipe(prod ? babel({
presets: ['es2015']
}) : gutil.noop())
.pipe(concat('bundle.js'))
.pipe(!prod ? sourcemaps.write('.') : gutil.noop())
.pipe(prod ? streamify(uglify()) : gutil.noop())
.pipe(gulp.dest('./build/js'))
.pipe(browserSync.stream());
Expand Down
6 changes: 3 additions & 3 deletions app/templates/_main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var $ = require('jquery');
var foundation = require('foundation');
var $ = require('jquery');
var foundation = <% if (props.foundationVersion) { %>require('../../node_modules/foundation-sites/dist/foundation.js');<% } else { %>require('foundation');<% } %>

$(document).foundation();
$(document).foundation();
7 changes: 6 additions & 1 deletion app/templates/_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
},
"license": "ISC",
"devDependencies": {
"babel-preset-es2015": "^6.3.13",
"browser-sync": "^2.7.6",
"browserify": "^10.1.2",
"browserify-shim": "^3.8.6",
Expand All @@ -28,16 +29,20 @@
"gulp-sequence": "^0.3.2",<% if (!props.compass) { %>
"gulp-sass": "^2.0.0",<% } else { %>
"gulp-compass": "^2.0.4",<% } %>
"gulp-concat": "^2.6.0",
"gulp-sourcemaps": "^1.6.0",
"gulp-babel": "^6.1.1",
"gulp-streamify": "0.0.5",
"gulp-uglify": "^1.2.0",
"gulp-util": "^3.0.4",
"gulp-watch": "^4.2.4",<% if (props.bourbon) { %>
"node-bourbon": "^4.2.3",<% } %>
"vinyl-buffer": "^1.0.0",
"vinyl-source-stream": "^1.1.0",
"watchify": "^3.2.1"
},
"dependencies": {
"foundation-sites": "^5.5.2",
<% if (props.foundationVersion) { %>"foundation-sites": "^6.1.1"<% } else { %>"foundation-sites": "^5.5.3"<% } %>,
"jquery": "^2.1.4"
},
"browser": {
Expand Down
File renamed without changes.
Loading

0 comments on commit f80cea1

Please sign in to comment.