Skip to content

Commit

Permalink
Merge pull request #5 from surprisehighway/update-1.0.6
Browse files Browse the repository at this point in the history
Move source above public. ES2015ify Gulp setup.
  • Loading branch information
rmknecht authored Dec 8, 2017
2 parents e4234c2 + 5699d7f commit 3e3cee8
Show file tree
Hide file tree
Showing 33 changed files with 541 additions and 337 deletions.
93 changes: 64 additions & 29 deletions generators/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = yeoman.generators.Base.extend({
_updateCheck: function(){
var notifier = updateNotifier({
pkg: pkg,
updateCheckInterval: 1000 * 60 * 60 * 24 // one day
updateCheckInterval: 0 // 1000 * 60 * 60 * 24 // one day
});

notifier.notify({defer: false});
Expand Down Expand Up @@ -117,14 +117,18 @@ module.exports = yeoman.generators.Base.extend({
scaffoldFolders: function(){
mkdirp(docRoot+'/assets');
mkdirp(docRoot+'/assets/components');
mkdirp(docRoot+'/assets/css');
mkdirp(docRoot+'/assets/dist');
mkdirp(docRoot+'/assets/dist/js');
mkdirp(docRoot+'/assets/dist/css');
mkdirp(docRoot+'/assets/img');
mkdirp(docRoot+'/assets/js');
mkdirp(docRoot+'/assets/js/build');
mkdirp(docRoot+'/assets/scss');
mkdirp(docRoot+'/assets/vendor');
mkdirp(docRoot+'/mockups');
mkdirp(docRoot+'/mockups/_includes');
mkdirp('/gulp-tasks');
mkdirp('/source');
mkdirp('/source/js');
mkdirp('/source/scss');
},

writing: {
Expand All @@ -139,19 +143,39 @@ module.exports = yeoman.generators.Base.extend({
);
},


gulpfile: function () {
this.fs.copyTpl(
this.templatePath('_gulpfile.js'),
this.destinationPath('gulpfile.js'),
this.templatePath('_gulpfile.babel.js'),
this.destinationPath('gulpfile.babel.js'),
{
date: this.props.date,
genName: pkg.name,
genVersion: pkg.version,
appName: this.props.packageName,
docRoot: docRoot,
framework: this.props.framework,
addStyleGuide: this.props.addStyleGuide
}
);
this.fs.copy(
this.templatePath('gulp-tasks/**/*'),
this.destinationPath('gulp-tasks/')
);
this.fs.copyTpl(
this.templatePath('gulp-tasks/styles.js'),
this.destinationPath('gulp-tasks/styles.js'),
{
framework: this.props.framework
}
);
this.fs.copyTpl(
this.templatePath('gulp-tasks/paths.js'),
this.destinationPath('gulp-tasks/paths.js'),
{
docRoot: docRoot
}
);
},

bower: function() {
Expand Down Expand Up @@ -180,6 +204,11 @@ module.exports = yeoman.generators.Base.extend({
},

project: function() {
this.fs.copyTpl(
this.templatePath('project/_babelrc'),
this.destinationPath('.babelrc'),
{ docRoot: docRoot }
);
this.fs.copyTpl(
this.templatePath('project/_bowerrc'),
this.destinationPath('.bowerrc'),
Expand Down Expand Up @@ -224,34 +253,35 @@ module.exports = yeoman.generators.Base.extend({
/* Copy the common scss assets */
this.fs.copy(
this.templatePath('scss/common/**/*'),
this.destinationPath(docRoot+'/assets/scss/')
this.destinationPath('source/scss/')
);

/* Render the main styles.scss template */
this.fs.copyTpl(
this.templatePath('scss/default/styles.scss'),
this.destinationPath(docRoot+'/assets/scss/styles.scss'),
this.destinationPath('source/scss/styles.scss'),
{
docRoot: docRoot,
framework: this.props.framework,
addStyleGuide: this.props.addStyleGuide
}
);

this.fs.copyTpl(
this.templatePath('scss/default/_base.scss'),
this.destinationPath(docRoot+'/assets/scss/_base.scss'),
this.destinationPath('source/scss/_base.scss'),
{ framework: this.props.framework }
);

this.fs.copyTpl(
this.templatePath('scss/default/modules/_forms.scss'),
this.destinationPath(docRoot+'/assets/scss/modules/_forms.scss'),
this.destinationPath('source/scss/modules/_forms.scss'),
{ framework: this.props.framework }
);

this.fs.copy(
this.templatePath('scss/default/_variables.scss'),
this.destinationPath(docRoot+'/assets/scss/_variables.scss')
this.destinationPath('source/scss/_variables.scss')
);
},

Expand All @@ -261,46 +291,51 @@ module.exports = yeoman.generators.Base.extend({
case 'incBourbonNeat':
this.fs.copy(
this.templatePath('scss/bourbon-neat/**/*'),
this.destinationPath(docRoot+'/assets/scss/')
this.destinationPath('source/scss/')
);
break;
case 'incFoundation':
this.fs.copy(
this.templatePath('/scss/foundation/_foundation.scss'),
this.destinationPath(docRoot+'/assets/scss/vendor/_foundation.scss')
this.fs.copyTpl(
this.templatePath('scss/foundation/_foundation.scss'),
this.destinationPath('source/scss/vendor/_foundation.scss'),
{ docRoot: docRoot }
);

this.fs.copy(
this.templatePath('/scss/foundation/_settings.scss'),
this.destinationPath(docRoot+'/assets/scss/vendor/_settings.scss')
this.fs.copyTpl(
this.templatePath('scss/foundation/_settings.scss'),
this.destinationPath('source/scss/vendor/_settings.scss'),
{ docRoot: docRoot }
);

this.fs.copy(
this.templatePath('scss/foundation/modules/**/*'),
this.destinationPath(docRoot+'/assets/scss/modules/')
this.destinationPath('source/scss/modules/')
);

break;
case 'incBootstrap':
this.fs.copy(
this.templatePath('/scss/bootstrap/_bootstrap-custom.scss'),
this.destinationPath(docRoot+'/assets/scss/vendor/_bootstrap-custom.scss')
this.fs.copyTpl(
this.templatePath('scss/bootstrap/_bootstrap-custom.scss'),
this.destinationPath('source/scss/vendor/_bootstrap-custom.scss'),
{ docRoot: docRoot }
);

this.fs.copy(
this.fs.copyTpl(
this.templatePath('scss/bootstrap/_bootstrap-settings.scss'),
this.destinationPath(docRoot+'/assets/scss/vendor/_bootstrap-settings.scss')
this.destinationPath('source/scss/vendor/_bootstrap-settings.scss'),
{ docRoot: docRoot }
);

this.fs.copy(
this.templatePath('scss/bootstrap/modules/**/*'),
this.destinationPath(docRoot+'/assets/scss/modules/')
this.destinationPath('source/scss/modules/')
);
break;
default:
if(this.props.addStyleGuide) {
this.fs.copy(
this.templatePath('scss/default/modules/_styleguide.scss'),
this.destinationPath(docRoot+'/assets/scss/modules/_styleguide.scss')
this.destinationPath('source/scss/modules/_styleguide.scss')
);
}
}
Expand All @@ -313,7 +348,7 @@ module.exports = yeoman.generators.Base.extend({

this.fs.copyTpl(
this.templatePath('js/**/*'),
this.destinationPath(docRoot+'/assets/js/'),
this.destinationPath('source/js/'),
context
);

Expand Down Expand Up @@ -364,9 +399,9 @@ module.exports = yeoman.generators.Base.extend({
}.bind(this)
});

var tasks = ['styles', 'scripts', 'bower'];
var tasks = ['dist', 'wire:mockups'];

if(this.props.addStyleGuide) { tasks.push('bower:styleguide'); }
if(this.props.addStyleGuide) { tasks.push('wire:styleguide'); }

this.on('dependenciesInstalled', function() {
/*
Expand Down
7 changes: 2 additions & 5 deletions generators/app/templates/_bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "<%= appName %>",
"version": "0.0.1",
"version": "0.0.2",
"homepage": "http://www.surprisehighway.com",
"authors": [
"Rob Knecht <[email protected]>",
Expand All @@ -24,10 +24,7 @@
<% } %>
<% if (framework == "incBootstrap"){ %>"bootstrap-sass": "~3.3.6",<% } %>
<% if (framework == "incFoundation"){ %>"foundation-sites": "~6.1.2",<% } %>
"html5shiv": "~3.7.0",
"jquery": "~2.0.3",
"modernizr": "~2.8.3",
"jquery-placeholder": "~2.1.2"
"jquery": "~3.2.1"
},
"devDependencies": {
<% if (framework != "incBootstrap"){ %>"normalize-scss": "~3.0.3"<% } %>
Expand Down
74 changes: 74 additions & 0 deletions generators/app/templates/_gulpfile.babel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/*
Generated on <%= date %> using <%= genName %> <%= genVersion %>
*/

// Enter the proxy url running your local php server
const local_proxy = '<%= appName %>.dev';

import { HTTP_PATH, SCSS_DIR, JS_DIR } from './gulp-tasks/paths';

import gulp from 'gulp';
import browserSync from 'browser-sync';
import styles from './gulp-tasks/styles';
import scripts from './gulp-tasks/scripts';
import { clean, cleanScripts, cleanStyles, cleanApp } from './gulp-tasks/clean';
import { distStyles, distScripts, distApp } from './gulp-tasks/dist';
import { wireMockups, wireStyleguide } from './gulp-tasks/bower';


browserSync.create();

// Process our sass
gulp.task('styles', ['clean:styles'], styles);

// Process our scripts
gulp.task('scripts', ['clean:scripts'], scripts);


// Delete everything in the dist directory
gulp.task('clean', clean);

// Delete all JS scripts in dist directory
gulp.task('clean:scripts', cleanScripts);

// Delete all CSS in dist directory
gulp.task('clean:styles', cleanStyles);


// Rev styles and scripts.
gulp.task('dist:scripts', ['scripts'], distScripts);

gulp.task('dist:styles', ['styles'], distStyles);

gulp.task('dist', ['dist:scripts', 'dist:styles'], function() { return; });


// Wire bower components up to our mockup and styleguide templates.
gulp.task('wire:mockups', wireMockups);

<% if (addStyleGuide) { %>
gulp.task('wire:styleguide', wireStyleguide);
<% } %>

// Watch for file changes.
gulp.task('watch', function() {

// Proxy Browser Sync through local url
browserSync.init({ proxy: local_proxy, notify: false });

// Watch .scss files
gulp.watch(SCSS_DIR + '/**/*.scss', ['dist:styles']);

// Watch .js files
gulp.watch(JS_DIR + '/**/*.js', ['dist:scripts']);

// Watch mockups
gulp.watch([HTTP_PATH+'/mockups/**/*.html', HTTP_PATH+'/mockups/**/*.php']).on('change', browserSync.reload);

});


// Our default gulp tasks.
gulp.task('default', ['dist', 'watch'], function(){});
Loading

0 comments on commit 3e3cee8

Please sign in to comment.