From b6e39881066124bda40e0611fd0cb7c1d3ed78ff Mon Sep 17 00:00:00 2001 From: Mike Kroll Date: Mon, 4 Dec 2017 14:47:27 -0600 Subject: [PATCH 1/6] Move source above public. ES2015ify Gulp setup. --- generators/app/index.js | 91 ++++++++---- generators/app/templates/_bower.json | 7 +- generators/app/templates/_gulpfile.babel.js | 99 +++++++++++++ generators/app/templates/_gulpfile.js | 137 ------------------ generators/app/templates/_package.json | 12 +- generators/app/templates/gulp-tasks/bower.js | 30 ++++ generators/app/templates/gulp-tasks/clean.js | 26 ++++ generators/app/templates/gulp-tasks/dist.js | 31 ++++ generators/app/templates/gulp-tasks/paths.js | 13 ++ .../app/templates/gulp-tasks/scripts.js | 41 ++++++ generators/app/templates/gulp-tasks/styles.js | 34 +++++ .../mockups/_includes/_functions.php | 19 +++ .../mockups/_includes/site-footer.php | 4 +- .../mockups/_includes/site-header.php | 5 +- generators/app/templates/project/_babelrc | 4 + .../app/templates/project/_gitattributes | 6 +- generators/app/templates/project/nvmrc | 2 +- .../scss/bootstrap/_bootstrap-custom.scss | 78 +++++----- .../app/templates/scss/default/styles.scss | 2 +- .../scss/foundation/_foundation.scss | 72 ++++----- .../templates/scss/foundation/_settings.scss | 2 +- .../styleguide/styleguide-bootstrap.php | 5 +- .../styleguide/styleguide-default.php | 5 +- package.json | 2 +- test/bootstrap.js | 22 +-- test/bourbon.js | 50 +++---- test/default.js | 2 +- test/foundation.js | 20 +-- test/general.js | 28 ++-- test/project-name.js | 4 +- test/styleguide.js | 8 +- 31 files changed, 530 insertions(+), 331 deletions(-) create mode 100644 generators/app/templates/_gulpfile.babel.js delete mode 100644 generators/app/templates/_gulpfile.js create mode 100755 generators/app/templates/gulp-tasks/bower.js create mode 100755 generators/app/templates/gulp-tasks/clean.js create mode 100755 generators/app/templates/gulp-tasks/dist.js create mode 100755 generators/app/templates/gulp-tasks/paths.js create mode 100755 generators/app/templates/gulp-tasks/scripts.js create mode 100755 generators/app/templates/gulp-tasks/styles.js create mode 100644 generators/app/templates/mockups/_includes/_functions.php create mode 100644 generators/app/templates/project/_babelrc diff --git a/generators/app/index.js b/generators/app/index.js index 0f96387..3653140 100644 --- a/generators/app/index.js +++ b/generators/app/index.js @@ -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: { @@ -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() { @@ -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'), @@ -224,14 +253,15 @@ 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 } @@ -239,19 +269,19 @@ module.exports = yeoman.generators.Base.extend({ 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') ); }, @@ -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') ); } } @@ -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 ); @@ -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() { /* diff --git a/generators/app/templates/_bower.json b/generators/app/templates/_bower.json index 3a12790..803fd09 100644 --- a/generators/app/templates/_bower.json +++ b/generators/app/templates/_bower.json @@ -1,6 +1,6 @@ { "name": "<%= appName %>", - "version": "0.0.1", + "version": "0.0.2", "homepage": "http://www.surprisehighway.com", "authors": [ "Rob Knecht ", @@ -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"<% } %> diff --git a/generators/app/templates/_gulpfile.babel.js b/generators/app/templates/_gulpfile.babel.js new file mode 100644 index 0000000..78a9dfe --- /dev/null +++ b/generators/app/templates/_gulpfile.babel.js @@ -0,0 +1,99 @@ +/* + + Generated on <%= date %> using <%= genName %> <%= genVersion %> + +*/ + +/* Common paths */ + +// 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(){}); + +/* + + Generated on <%= date %> using <%= genName %> <%= genVersion %> + +*/ + +/* Common paths */ +var http_path = '<%= docRoot %>', + asset_path = http_path + '/assets', + css_dir = asset_path + '/css', + scss_dir = asset_path + '/scss', + images_dir = asset_path + '/img', + js_dir = asset_path + '/js', + js_build_dir = asset_path + '/js/build'; + +/* JavaScript asset paths. */ +var js_assets = [ + asset_path + '/components/jquery-placeholder/jquery.placeholder.min.js', + js_dir + '/plugins.js', + js_dir + '/common.js', + js_dir + '/site.js' +]; \ No newline at end of file diff --git a/generators/app/templates/_gulpfile.js b/generators/app/templates/_gulpfile.js deleted file mode 100644 index fa2c958..0000000 --- a/generators/app/templates/_gulpfile.js +++ /dev/null @@ -1,137 +0,0 @@ -/* - - Generated on <%= date %> using <%= genName %> <%= genVersion %> - -*/ - -/* Common paths */ -var http_path = '<%= docRoot %>', - asset_path = http_path + '/assets', - css_dir = asset_path + '/css', - scss_dir = asset_path + '/scss', - images_dir = asset_path + '/img', - js_dir = asset_path + '/js', - js_build_dir = asset_path + '/js/build'; - -/* JavaScript asset paths. */ -var js_assets = [ - asset_path + '/components/jquery-placeholder/jquery.placeholder.min.js', - js_dir + '/plugins.js', - js_dir + '/common.js', - js_dir + '/site.js' -]; - -/* - Or select everything within the JS directory: - var js_assets = js_dir + '/*.js'; -*/ - - -/* Gulp Plugins */ -var gulp = require('gulp'), - livereload = require('gulp-livereload'), - scss = require('gulp-sass'), - cssnano = require('gulp-cssnano'), - prefix = require('gulp-autoprefixer'), - uglify = require('gulp-uglify'), - rename = require('gulp-rename'), - concat = require('gulp-concat'), - <% if (framework == "incBourbonNeat") { %> - bourbon = require('bourbon'), - neat = require('bourbon-neat'), - <% } %> - wiredep = require('wiredep').stream; - -/* - Process our sass files and minify the resultant CSS. -*/ -gulp.task('styles', function() { - gulp.src(scss_dir + '/styles.scss') - .pipe(scss(<% if (framework == "incBourbonNeat") { %>{includePaths: bourbon.includePaths.concat(neat.includePaths)}<% } %>)) - .on('error', function (err) { - console.log(err.message); - this.emit('end'); - }) - .pipe(prefix({ - browsers: ['last 2 versions', '> 1%', 'IE 9'], - cascade: false - })) - .pipe(gulp.dest(css_dir)) - .pipe(rename({suffix: '.min'})) - .pipe(cssnano({autoprefixer: false})) - .pipe(gulp.dest(css_dir)) - .pipe(livereload()); -}); - - - -/* - Concatenate and minify our JavaScript assets. -*/ -gulp.task('scripts', function() { - return gulp.src(js_assets) - .pipe(concat('site.js')) - .pipe(gulp.dest(js_build_dir)) - .pipe(rename({suffix: '.min'})) - .pipe(uglify()) - .pipe(gulp.dest(js_build_dir)) - .pipe(livereload()); -}); - - -/* - Wire bower components up to our mockup templates. -*/ -gulp.task('bower', function () { - gulp.src([http_path+'/mockups/_includes/site-header.php', http_path+'/mockups/_includes/site-footer.php']) - .pipe(wiredep({ - ignorePath: '../..', - exclude: [ - asset_path + '/components/jquery/', - asset_path + '/components/jquery-placeholder/', - asset_path + '/components/html5shiv/', - asset_path + '/components/modernizr/', - ], - })) - .pipe(gulp.dest(http_path+'/mockups/_includes/')); -}); - -<% if (addStyleGuide) { %> -/* - Wire bower components up to our styleguide. -*/ -gulp.task('bower:styleguide', function () { - gulp.src([http_path+'/mockups/styleguide.php']) - .pipe(wiredep({ - ignorePath: '../..', - exclude: [ - asset_path + '/components/jquery/', - asset_path + '/components/jquery-placeholder/', - asset_path + '/components/html5shiv/', - asset_path + '/components/modernizr/', - ], - })) - .pipe(gulp.dest(http_path+'/mockups/')); -}); -<% } %> - -/* - Watch for file changes. -*/ -gulp.task('watch', function() { - - livereload.listen(); - - // Watch .scss files - gulp.watch(scss_dir + '/**/*.scss', ['styles']); - - // Watch .js files - gulp.watch([js_dir + '/**/*.js', '!'+js_dir+'/build/**/*.js'], ['scripts']); - -}); - - -/* - Our default gulp tasks. -*/ -gulp.task('default', ['scripts', 'styles', 'watch'], function(){}); \ No newline at end of file diff --git a/generators/app/templates/_package.json b/generators/app/templates/_package.json index b8d6faa..fb60566 100644 --- a/generators/app/templates/_package.json +++ b/generators/app/templates/_package.json @@ -15,14 +15,22 @@ "url": "https://github.com/surprisehighway/" }, "devDependencies": { + "babel-core": "^6.26.0", + "babel-plugin-transform-object-rest-spread": "^6.26.0", + "babel-preset-es2015": "^6.24.1", + "babelify": "^7.3.0", + "browser-sync": "^2.18.13", "gulp": "~3.9", "gulp-autoprefixer": "^3.1.0", + "gulp-clean": "^0.3.2", "gulp-concat": "~2.2.0", "gulp-cssnano": "^2.1.1", - "gulp-livereload": "~3.2.0", "gulp-rename": "~1.2.0", + "gulp-rev": "^8.0.0", "gulp-sass": "^2.3.2", - "gulp-uglify": "~0.3.2", + "gulp-sourcemaps": "^2.6.1", + "gulp-uglify": "^3.0.0", + "gulp-util": "^3.0.8", <% if (framework == "incBourbonNeat") { %> "bourbon": "^4.2.7", "bourbon-neat": "^1.8.0", diff --git a/generators/app/templates/gulp-tasks/bower.js b/generators/app/templates/gulp-tasks/bower.js new file mode 100755 index 0000000..960eedb --- /dev/null +++ b/generators/app/templates/gulp-tasks/bower.js @@ -0,0 +1,30 @@ +/* + wire.js +*/ +import {HTTP_PATH, ASSET_PATH} from './paths'; +import gulp from 'gulp'; +import wiredep from 'wiredep'; + +let wd = wiredep.stream; + +export function wireMockups() { + return gulp.src([HTTP_PATH+'/mockups/_includes/site-header.php', HTTP_PATH+'/mockups/_includes/site-footer.php']) + .pipe(wd({ + ignorePath: '../..', + exclude: [ + ASSET_PATH + '/components/jquery/' + ], + })) + .pipe(gulp.dest(HTTP_PATH+'/mockups/_includes/')); +} + +export function wireStyleguide() { + return gulp.src([HTTP_PATH+'/mockups/styleguide.php']) + .pipe(wd({ + ignorePath: '../..', + exclude: [ + ASSET_PATH + '/components/jquery/' + ], + })) + .pipe(gulp.dest(HTTP_PATH+'/mockups/')); +} diff --git a/generators/app/templates/gulp-tasks/clean.js b/generators/app/templates/gulp-tasks/clean.js new file mode 100755 index 0000000..6fe5dc3 --- /dev/null +++ b/generators/app/templates/gulp-tasks/clean.js @@ -0,0 +1,26 @@ +/* + clean.js +*/ +import {DIST_PATH, JS_BUILD_DIR, APP_BUILD_DIR, CSS_DIR} from './paths'; +import gulp from 'gulp'; +import gClean from 'gulp-clean'; + +export function clean() { + return gulp.src(DIST_PATH+'/*', {read: false}) + .pipe(gClean()); +} + +export function cleanScripts() { + return gulp.src(JS_BUILD_DIR+'/*', {read: false}) + .pipe(gClean()); +} + +export function cleanStyles() { + return gulp.src(CSS_DIR+'/*', {read: false}) + .pipe(gClean()); +} + +export function cleanApp() { + return gulp.src(APP_BUILD_DIR+'/*', {read: false}) + .pipe(gClean()); +} diff --git a/generators/app/templates/gulp-tasks/dist.js b/generators/app/templates/gulp-tasks/dist.js new file mode 100755 index 0000000..dd39864 --- /dev/null +++ b/generators/app/templates/gulp-tasks/dist.js @@ -0,0 +1,31 @@ +/* + dist.js +*/ +import {DIST_PATH, JS_BUILD_DIR, CSS_DIR, APP_BUILD_DIR} from './paths'; +import gulp from 'gulp'; +import rev from 'gulp-rev'; +import browserSync from 'browser-sync'; + +export function distScripts() { + return gulp.src(JS_BUILD_DIR+'/*.min.js', {base: DIST_PATH}) + .pipe(rev()) + .pipe(gulp.dest(DIST_PATH)) + .pipe(rev.manifest(DIST_PATH+'/rev-manifest.json', { + base: DIST_PATH, + merge: true + })) + .pipe(gulp.dest(DIST_PATH)) + .pipe(browserSync.stream()); +} + +export function distStyles() { + return gulp.src(CSS_DIR+'/*.min.css', {base: DIST_PATH}) + .pipe(rev()) + .pipe(gulp.dest(DIST_PATH)) + .pipe(rev.manifest(DIST_PATH+'/rev-manifest.json', { + base: DIST_PATH, + merge: true + })) + .pipe(gulp.dest(DIST_PATH)) + .pipe(browserSync.stream()); +} \ No newline at end of file diff --git a/generators/app/templates/gulp-tasks/paths.js b/generators/app/templates/gulp-tasks/paths.js new file mode 100755 index 0000000..4cd74d8 --- /dev/null +++ b/generators/app/templates/gulp-tasks/paths.js @@ -0,0 +1,13 @@ +/* + paths.js + Common paths +*/ + +export const HTTP_PATH = '<%= docRoot %>'; +export const SRC_PATH = 'source'; +export const ASSET_PATH = HTTP_PATH + '/assets'; +export const DIST_PATH = ASSET_PATH + '/dist'; +export const SCSS_DIR = SRC_PATH + '/scss'; +export const CSS_DIR = DIST_PATH + '/css'; +export const JS_DIR = SRC_PATH + '/js'; +export const JS_BUILD_DIR = DIST_PATH + '/js'; \ No newline at end of file diff --git a/generators/app/templates/gulp-tasks/scripts.js b/generators/app/templates/gulp-tasks/scripts.js new file mode 100755 index 0000000..da444d1 --- /dev/null +++ b/generators/app/templates/gulp-tasks/scripts.js @@ -0,0 +1,41 @@ +/* + scripts.js +*/ + +import { JS_BUILD_DIR, ASSET_PATH, JS_DIR } from './paths'; +import gulp from 'gulp'; +import concat from 'gulp-concat'; +import rename from 'gulp-rename'; +import uglify from 'gulp-uglify'; + +/* JavaScript asset paths. */ +const JS_ASSETS = [ + //ASSET_PATH + '/components/path/resource.js', + JS_DIR + '/plugins.js', + JS_DIR + '/common.js', + JS_DIR + '/animate.js', + JS_DIR + '/maps.js', + JS_DIR + '/forms.js', + JS_DIR + '/site.js' +]; + +// Or select everything within the JS directory: +// const JS_ASSETS = js_dir + '/*.js'; + + +/* + Concatenate and minify our JavaScript assets. +*/ + +export default function() { + return gulp.src(JS_ASSETS) + .pipe(concat('site.js')) + .pipe(gulp.dest(JS_BUILD_DIR)) + .pipe(rename({suffix: '.min'})) + .pipe(uglify()) + .on('error', function (err) { + console.log(err.message); + this.emit('end'); + }) + .pipe(gulp.dest(JS_BUILD_DIR)); +} \ No newline at end of file diff --git a/generators/app/templates/gulp-tasks/styles.js b/generators/app/templates/gulp-tasks/styles.js new file mode 100755 index 0000000..73efd52 --- /dev/null +++ b/generators/app/templates/gulp-tasks/styles.js @@ -0,0 +1,34 @@ +/* + styles.js +*/ + +import {SCSS_DIR, CSS_DIR} from './paths'; +import gulp from 'gulp'; +import scss from 'gulp-sass'; +import cssnano from 'gulp-cssnano'; +import rename from 'gulp-rename'; +import prefix from 'gulp-autoprefixer'; +<% if (framework == "incBourbonNeat") { %> + import bourbon from 'bourbon'; + import neat from 'bourbon-neat'; +<% } %> + +/* + Process our sass files and minify the resultant CSS. +*/ +export default function() { + return gulp.src(SCSS_DIR + '/styles.scss') + .pipe(scss(<% if (framework == "incBourbonNeat") { %>{includePaths: bourbon.includePaths.concat(neat.includePaths)}<% } %>)) + .on('error', function (err) { + console.log(err.message); + this.emit('end'); + }) + .pipe(prefix({ + browsers: ['last 2 versions', '> 1%', 'IE 9', 'iOS >= 8'], + cascade: false + })) + .pipe(gulp.dest(CSS_DIR)) + .pipe(rename({suffix: '.min'})) + .pipe(cssnano({autoprefixer: false, zindex: false})) + .pipe(gulp.dest(CSS_DIR)); +} \ No newline at end of file diff --git a/generators/app/templates/mockups/_includes/_functions.php b/generators/app/templates/mockups/_includes/_functions.php new file mode 100644 index 0000000..b224da3 --- /dev/null +++ b/generators/app/templates/mockups/_includes/_functions.php @@ -0,0 +1,19 @@ + - + - + diff --git a/generators/app/templates/mockups/_includes/site-header.php b/generators/app/templates/mockups/_includes/site-header.php index 0becfe4..32fe2b7 100644 --- a/generators/app/templates/mockups/_includes/site-header.php +++ b/generators/app/templates/mockups/_includes/site-header.php @@ -1,3 +1,4 @@ + @@ -9,9 +10,7 @@ - - - + diff --git a/generators/app/templates/project/_babelrc b/generators/app/templates/project/_babelrc new file mode 100644 index 0000000..ae8a221 --- /dev/null +++ b/generators/app/templates/project/_babelrc @@ -0,0 +1,4 @@ +{ + "presets": ["es2015"], + "plugins": ["transform-object-rest-spread"] +} \ No newline at end of file diff --git a/generators/app/templates/project/_gitattributes b/generators/app/templates/project/_gitattributes index b973c0d..89469a2 100644 --- a/generators/app/templates/project/_gitattributes +++ b/generators/app/templates/project/_gitattributes @@ -2,8 +2,8 @@ *.css linguist-vendored *.less linguist-vendored <%= docRoot %>/assets/components/* linguist-vendored -<%= docRoot %>/assets/js/build/* linguist-vendored +<%= docRoot %>/assets/dist/js/* linguist-vendored <%= docRoot %>/assets/vendor/* linguist-vendored <%= docRoot %>/mockups/* linguist-vendored -<%= docRoot %>/assets/js/build/*.js binary -<%= docRoot %>/assets/css/*.css binary \ No newline at end of file +<%= docRoot %>/assets/dist/js/*.js binary +<%= docRoot %>/assets/dist/css/*.css binary \ No newline at end of file diff --git a/generators/app/templates/project/nvmrc b/generators/app/templates/project/nvmrc index 1b28632..b692764 100644 --- a/generators/app/templates/project/nvmrc +++ b/generators/app/templates/project/nvmrc @@ -1 +1 @@ -5.6 \ No newline at end of file +7.10 \ No newline at end of file diff --git a/generators/app/templates/scss/bootstrap/_bootstrap-custom.scss b/generators/app/templates/scss/bootstrap/_bootstrap-custom.scss index 59c8187..4a4da94 100644 --- a/generators/app/templates/scss/bootstrap/_bootstrap-custom.scss +++ b/generators/app/templates/scss/bootstrap/_bootstrap-custom.scss @@ -5,52 +5,52 @@ */ // Core variables and mixins -@import "../../components/bootstrap-sass/assets/stylesheets/bootstrap/variables"; -@import "../../components/bootstrap-sass/assets/stylesheets/bootstrap/mixins"; +@import "../../<%= docRoot %>/assets/components/bootstrap-sass/assets/stylesheets/bootstrap/variables"; +@import "../../<%= docRoot %>/assets/components/bootstrap-sass/assets/stylesheets/bootstrap/mixins"; // Reset and dependencies -@import "../../components/bootstrap-sass/assets/stylesheets/bootstrap/normalize"; -@import "../../components/bootstrap-sass/assets/stylesheets/bootstrap/print"; -@import "../../components/bootstrap-sass/assets/stylesheets/bootstrap/glyphicons"; +@import "../../<%= docRoot %>/assets/components/bootstrap-sass/assets/stylesheets/bootstrap/normalize"; +@import "../../<%= docRoot %>/assets/components/bootstrap-sass/assets/stylesheets/bootstrap/print"; +@import "../../<%= docRoot %>/assets/components/bootstrap-sass/assets/stylesheets/bootstrap/glyphicons"; // Core CSS -@import "../../components/bootstrap-sass/assets/stylesheets/bootstrap/scaffolding"; -@import "../../components/bootstrap-sass/assets/stylesheets/bootstrap/type"; -@import "../../components/bootstrap-sass/assets/stylesheets/bootstrap/code"; -@import "../../components/bootstrap-sass/assets/stylesheets/bootstrap/grid"; -@import "../../components/bootstrap-sass/assets/stylesheets/bootstrap/tables"; -@import "../../components/bootstrap-sass/assets/stylesheets/bootstrap/forms"; -@import "../../components/bootstrap-sass/assets/stylesheets/bootstrap/buttons"; +@import "../../<%= docRoot %>/assets/components/bootstrap-sass/assets/stylesheets/bootstrap/scaffolding"; +@import "../../<%= docRoot %>/assets/components/bootstrap-sass/assets/stylesheets/bootstrap/type"; +@import "../../<%= docRoot %>/assets/components/bootstrap-sass/assets/stylesheets/bootstrap/code"; +@import "../../<%= docRoot %>/assets/components/bootstrap-sass/assets/stylesheets/bootstrap/grid"; +@import "../../<%= docRoot %>/assets/components/bootstrap-sass/assets/stylesheets/bootstrap/tables"; +@import "../../<%= docRoot %>/assets/components/bootstrap-sass/assets/stylesheets/bootstrap/forms"; +@import "../../<%= docRoot %>/assets/components/bootstrap-sass/assets/stylesheets/bootstrap/buttons"; // Components -@import "../../components/bootstrap-sass/assets/stylesheets/bootstrap/component-animations"; -@import "../../components/bootstrap-sass/assets/stylesheets/bootstrap/dropdowns"; -@import "../../components/bootstrap-sass/assets/stylesheets/bootstrap/button-groups"; -@import "../../components/bootstrap-sass/assets/stylesheets/bootstrap/input-groups"; -@import "../../components/bootstrap-sass/assets/stylesheets/bootstrap/navs"; -@import "../../components/bootstrap-sass/assets/stylesheets/bootstrap/navbar"; -@import "../../components/bootstrap-sass/assets/stylesheets/bootstrap/breadcrumbs"; -@import "../../components/bootstrap-sass/assets/stylesheets/bootstrap/pagination"; -@import "../../components/bootstrap-sass/assets/stylesheets/bootstrap/pager"; -@import "../../components/bootstrap-sass/assets/stylesheets/bootstrap/labels"; -@import "../../components/bootstrap-sass/assets/stylesheets/bootstrap/badges"; -@import "../../components/bootstrap-sass/assets/stylesheets/bootstrap/jumbotron"; -@import "../../components/bootstrap-sass/assets/stylesheets/bootstrap/thumbnails"; -@import "../../components/bootstrap-sass/assets/stylesheets/bootstrap/alerts"; -@import "../../components/bootstrap-sass/assets/stylesheets/bootstrap/progress-bars"; -@import "../../components/bootstrap-sass/assets/stylesheets/bootstrap/media"; -@import "../../components/bootstrap-sass/assets/stylesheets/bootstrap/list-group"; -@import "../../components/bootstrap-sass/assets/stylesheets/bootstrap/panels"; -@import "../../components/bootstrap-sass/assets/stylesheets/bootstrap/responsive-embed"; -@import "../../components/bootstrap-sass/assets/stylesheets/bootstrap/wells"; -@import "../../components/bootstrap-sass/assets/stylesheets/bootstrap/close"; +@import "../../<%= docRoot %>/assets/components/bootstrap-sass/assets/stylesheets/bootstrap/component-animations"; +@import "../../<%= docRoot %>/assets/components/bootstrap-sass/assets/stylesheets/bootstrap/dropdowns"; +@import "../../<%= docRoot %>/assets/components/bootstrap-sass/assets/stylesheets/bootstrap/button-groups"; +@import "../../<%= docRoot %>/assets/components/bootstrap-sass/assets/stylesheets/bootstrap/input-groups"; +@import "../../<%= docRoot %>/assets/components/bootstrap-sass/assets/stylesheets/bootstrap/navs"; +@import "../../<%= docRoot %>/assets/components/bootstrap-sass/assets/stylesheets/bootstrap/navbar"; +@import "../../<%= docRoot %>/assets/components/bootstrap-sass/assets/stylesheets/bootstrap/breadcrumbs"; +@import "../../<%= docRoot %>/assets/components/bootstrap-sass/assets/stylesheets/bootstrap/pagination"; +@import "../../<%= docRoot %>/assets/components/bootstrap-sass/assets/stylesheets/bootstrap/pager"; +@import "../../<%= docRoot %>/assets/components/bootstrap-sass/assets/stylesheets/bootstrap/labels"; +@import "../../<%= docRoot %>/assets/components/bootstrap-sass/assets/stylesheets/bootstrap/badges"; +@import "../../<%= docRoot %>/assets/components/bootstrap-sass/assets/stylesheets/bootstrap/jumbotron"; +@import "../../<%= docRoot %>/assets/components/bootstrap-sass/assets/stylesheets/bootstrap/thumbnails"; +@import "../../<%= docRoot %>/assets/components/bootstrap-sass/assets/stylesheets/bootstrap/alerts"; +@import "../../<%= docRoot %>/assets/components/bootstrap-sass/assets/stylesheets/bootstrap/progress-bars"; +@import "../../<%= docRoot %>/assets/components/bootstrap-sass/assets/stylesheets/bootstrap/media"; +@import "../../<%= docRoot %>/assets/components/bootstrap-sass/assets/stylesheets/bootstrap/list-group"; +@import "../../<%= docRoot %>/assets/components/bootstrap-sass/assets/stylesheets/bootstrap/panels"; +@import "../../<%= docRoot %>/assets/components/bootstrap-sass/assets/stylesheets/bootstrap/responsive-embed"; +@import "../../<%= docRoot %>/assets/components/bootstrap-sass/assets/stylesheets/bootstrap/wells"; +@import "../../<%= docRoot %>/assets/components/bootstrap-sass/assets/stylesheets/bootstrap/close"; // Components w/ JavaScript -@import "../../components/bootstrap-sass/assets/stylesheets/bootstrap/modals"; -@import "../../components/bootstrap-sass/assets/stylesheets/bootstrap/tooltip"; -@import "../../components/bootstrap-sass/assets/stylesheets/bootstrap/popovers"; -@import "../../components/bootstrap-sass/assets/stylesheets/bootstrap/carousel"; +@import "../../<%= docRoot %>/assets/components/bootstrap-sass/assets/stylesheets/bootstrap/modals"; +@import "../../<%= docRoot %>/assets/components/bootstrap-sass/assets/stylesheets/bootstrap/tooltip"; +@import "../../<%= docRoot %>/assets/components/bootstrap-sass/assets/stylesheets/bootstrap/popovers"; +@import "../../<%= docRoot %>/assets/components/bootstrap-sass/assets/stylesheets/bootstrap/carousel"; // Utility classes -@import "../../components/bootstrap-sass/assets/stylesheets/bootstrap/utilities"; -@import "../../components/bootstrap-sass/assets/stylesheets/bootstrap/responsive-utilities"; +@import "../../<%= docRoot %>/assets/components/bootstrap-sass/assets/stylesheets/bootstrap/utilities"; +@import "../../<%= docRoot %>/assets/components/bootstrap-sass/assets/stylesheets/bootstrap/responsive-utilities"; diff --git a/generators/app/templates/scss/default/styles.scss b/generators/app/templates/scss/default/styles.scss index d8f8d59..e74d0e9 100644 --- a/generators/app/templates/scss/default/styles.scss +++ b/generators/app/templates/scss/default/styles.scss @@ -24,7 +24,7 @@ <% if (framework == "incBootstrap") { %> @import "vendor/bootstrap-custom"; <% } else { %> - @import "../components/normalize-scss/_normalize.scss"; + @import "../../<%= docRoot %>/assets/components/normalize-scss/_normalize.scss"; <% } %> diff --git a/generators/app/templates/scss/foundation/_foundation.scss b/generators/app/templates/scss/foundation/_foundation.scss index 89dfbd7..be19bcf 100644 --- a/generators/app/templates/scss/foundation/_foundation.scss +++ b/generators/app/templates/scss/foundation/_foundation.scss @@ -6,46 +6,46 @@ */ // Sass utilities -@import '../../components/foundation-sites/scss/util/util'; +@import '../../../<%= docRoot %>/assets/components/foundation-sites/scss/util/util'; // Global variables and styles -@import '../../components/foundation-sites/scss/global'; +@import '../../../<%= docRoot %>/assets/components/foundation-sites/scss/global'; // Components -@import '../../components/foundation-sites/scss/grid/grid'; -@import '../../components/foundation-sites/scss/typography/typography'; -@import '../../components/foundation-sites/scss/forms/forms'; -@import '../../components/foundation-sites/scss/components/visibility'; -@import '../../components/foundation-sites/scss/components/float'; -@import '../../components/foundation-sites/scss/components/button'; -@import '../../components/foundation-sites/scss/components/button-group'; -@import '../../components/foundation-sites/scss/components/accordion-menu'; -@import '../../components/foundation-sites/scss/components/accordion'; -@import '../../components/foundation-sites/scss/components/badge'; -@import '../../components/foundation-sites/scss/components/breadcrumbs'; -@import '../../components/foundation-sites/scss/components/callout'; -@import '../../components/foundation-sites/scss/components/close-button'; -@import '../../components/foundation-sites/scss/components/drilldown'; -@import '../../components/foundation-sites/scss/components/dropdown-menu'; -@import '../../components/foundation-sites/scss/components/dropdown'; -@import '../../components/foundation-sites/scss/components/flex-video'; -@import '../../components/foundation-sites/scss/components/label'; -@import '../../components/foundation-sites/scss/components/media-object'; -@import '../../components/foundation-sites/scss/components/menu'; -@import '../../components/foundation-sites/scss/components/off-canvas'; -@import '../../components/foundation-sites/scss/components/orbit'; -@import '../../components/foundation-sites/scss/components/pagination'; -@import '../../components/foundation-sites/scss/components/progress-bar'; -@import '../../components/foundation-sites/scss/components/reveal'; -@import '../../components/foundation-sites/scss/components/slider'; -@import '../../components/foundation-sites/scss/components/sticky'; -@import '../../components/foundation-sites/scss/components/switch'; -@import '../../components/foundation-sites/scss/components/table'; -@import '../../components/foundation-sites/scss/components/tabs'; -@import '../../components/foundation-sites/scss/components/title-bar'; -@import '../../components/foundation-sites/scss/components/top-bar'; -@import '../../components/foundation-sites/scss/components/thumbnail'; -@import '../../components/foundation-sites/scss/components/tooltip'; +@import '../../../<%= docRoot %>/assets/components/foundation-sites/scss/grid/grid'; +@import '../../../<%= docRoot %>/assets/components/foundation-sites/scss/typography/typography'; +@import '../../../<%= docRoot %>/assets/components/foundation-sites/scss/forms/forms'; +@import '../../../<%= docRoot %>/assets/components/foundation-sites/scss/components/visibility'; +@import '../../../<%= docRoot %>/assets/components/foundation-sites/scss/components/float'; +@import '../../../<%= docRoot %>/assets/components/foundation-sites/scss/components/button'; +@import '../../../<%= docRoot %>/assets/components/foundation-sites/scss/components/button-group'; +@import '../../../<%= docRoot %>/assets/components/foundation-sites/scss/components/accordion-menu'; +@import '../../../<%= docRoot %>/assets/components/foundation-sites/scss/components/accordion'; +@import '../../../<%= docRoot %>/assets/components/foundation-sites/scss/components/badge'; +@import '../../../<%= docRoot %>/assets/components/foundation-sites/scss/components/breadcrumbs'; +@import '../../../<%= docRoot %>/assets/components/foundation-sites/scss/components/callout'; +@import '../../../<%= docRoot %>/assets/components/foundation-sites/scss/components/close-button'; +@import '../../../<%= docRoot %>/assets/components/foundation-sites/scss/components/drilldown'; +@import '../../../<%= docRoot %>/assets/components/foundation-sites/scss/components/dropdown-menu'; +@import '../../../<%= docRoot %>/assets/components/foundation-sites/scss/components/dropdown'; +@import '../../../<%= docRoot %>/assets/components/foundation-sites/scss/components/flex-video'; +@import '../../../<%= docRoot %>/assets/components/foundation-sites/scss/components/label'; +@import '../../../<%= docRoot %>/assets/components/foundation-sites/scss/components/media-object'; +@import '../../../<%= docRoot %>/assets/components/foundation-sites/scss/components/menu'; +@import '../../../<%= docRoot %>/assets/components/foundation-sites/scss/components/off-canvas'; +@import '../../../<%= docRoot %>/assets/components/foundation-sites/scss/components/orbit'; +@import '../../../<%= docRoot %>/assets/components/foundation-sites/scss/components/pagination'; +@import '../../../<%= docRoot %>/assets/components/foundation-sites/scss/components/progress-bar'; +@import '../../../<%= docRoot %>/assets/components/foundation-sites/scss/components/reveal'; +@import '../../../<%= docRoot %>/assets/components/foundation-sites/scss/components/slider'; +@import '../../../<%= docRoot %>/assets/components/foundation-sites/scss/components/sticky'; +@import '../../../<%= docRoot %>/assets/components/foundation-sites/scss/components/switch'; +@import '../../../<%= docRoot %>/assets/components/foundation-sites/scss/components/table'; +@import '../../../<%= docRoot %>/assets/components/foundation-sites/scss/components/tabs'; +@import '../../../<%= docRoot %>/assets/components/foundation-sites/scss/components/title-bar'; +@import '../../../<%= docRoot %>/assets/components/foundation-sites/scss/components/top-bar'; +@import '../../../<%= docRoot %>/assets/components/foundation-sites/scss/components/thumbnail'; +@import '../../../<%= docRoot %>/assets/components/foundation-sites/scss/components/tooltip'; @mixin foundation-everything($flex: false) { @include foundation-global-styles; diff --git a/generators/app/templates/scss/foundation/_settings.scss b/generators/app/templates/scss/foundation/_settings.scss index c826f6b..f4200d2 100644 --- a/generators/app/templates/scss/foundation/_settings.scss +++ b/generators/app/templates/scss/foundation/_settings.scss @@ -39,7 +39,7 @@ // 34. Tooltip // 35. Top Bar -@import '../../components/foundation-sites/scss/util/util'; +@import '../../../<%= docRoot %>/assets/components/foundation-sites/scss/util/util'; // 1. Global // --------- diff --git a/generators/app/templates/styleguide/styleguide-bootstrap.php b/generators/app/templates/styleguide/styleguide-bootstrap.php index e6f584a..eca32ce 100644 --- a/generators/app/templates/styleguide/styleguide-bootstrap.php +++ b/generators/app/templates/styleguide/styleguide-bootstrap.php @@ -1,3 +1,4 @@ + @@ -8,9 +9,7 @@ - - - + diff --git a/generators/app/templates/styleguide/styleguide-default.php b/generators/app/templates/styleguide/styleguide-default.php index 614e3db..3c19728 100644 --- a/generators/app/templates/styleguide/styleguide-default.php +++ b/generators/app/templates/styleguide/styleguide-default.php @@ -1,3 +1,4 @@ + @@ -8,9 +9,7 @@ - - - + diff --git a/package.json b/package.json index 72c9b50..84cb72e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "generator-surprise", - "version": "1.0.5", + "version": "1.0.6", "description": "Yeoman Generator for Surprise Highway project front ends.", "license": "MIT", "main": "app/index.js", diff --git a/test/bootstrap.js b/test/bootstrap.js index efbb818..656838f 100644 --- a/test/bootstrap.js +++ b/test/bootstrap.js @@ -22,11 +22,11 @@ describe('surprise:boostrap', function () { }); it('generates the correct scss files', function () { - assert.fileContent(docRoot+'/assets/scss/styles.scss', '@import "vendor/bootstrap-settings";'); - assert.fileContent(docRoot+'/assets/scss/styles.scss', '@import "vendor/bootstrap-custom";'); - assert.fileContent(docRoot+'/assets/scss/modules/_styleguide.scss', 'Style guide styles for Bootstrap SASS'); - assert.file(docRoot+'/assets/scss/vendor/_bootstrap-custom.scss'); - assert.file(docRoot+'/assets/scss/vendor/_bootstrap-settings.scss'); + assert.fileContent('source/scss/styles.scss', '@import "vendor/bootstrap-settings";'); + assert.fileContent('source/scss/styles.scss', '@import "vendor/bootstrap-custom";'); + assert.fileContent('source/scss/modules/_styleguide.scss', 'Style guide styles for Bootstrap SASS'); + assert.file('source/scss/vendor/_bootstrap-custom.scss'); + assert.file('source/scss/vendor/_bootstrap-settings.scss'); }); describe('with style guide', function () { @@ -61,7 +61,7 @@ describe('surprise:boostrap', function () { }); it('imports _normalize.scss in styles.scss', function () { - assert.fileContent(docRoot+'/assets/scss/styles.scss', '@import "../components/normalize-scss/_normalize.scss";'); + assert.fileContent('source/scss/styles.scss', '@import "../../public_html/assets/components/normalize-scss/_normalize.scss";'); }); it('is not included in the readme file', function () { @@ -69,11 +69,11 @@ describe('surprise:boostrap', function () { }); it('does not generates scss', function () { - assert.noFileContent(docRoot+'/assets/scss/styles.scss', '@import "vendor/bootstrap-settings";'); - assert.noFileContent(docRoot+'/assets/scss/styles.scss', '@import "vendor/bootstrap-custom";'); - assert.noFileContent(docRoot+'/assets/scss/modules/_styleguide.scss', 'Style guide styles for Bootstrap SASS'); - assert.noFile(docRoot+'/assets/scss/vendor/_bootstrap-custom.scss'); - assert.noFile(docRoot+'/assets/scss/vendor/_bootstrap-settings.scss'); + assert.noFileContent('source/scss/styles.scss', '@import "vendor/bootstrap-settings";'); + assert.noFileContent('source/scss/styles.scss', '@import "vendor/bootstrap-custom";'); + assert.noFileContent('source/scss/modules/_styleguide.scss', 'Style guide styles for Bootstrap SASS'); + assert.noFile('source/scss/vendor/_bootstrap-custom.scss'); + assert.noFile('source/scss/vendor/_bootstrap-settings.scss'); }); }); }); \ No newline at end of file diff --git a/test/bourbon.js b/test/bourbon.js index 51ede40..83a4f89 100644 --- a/test/bourbon.js +++ b/test/bourbon.js @@ -23,9 +23,9 @@ describe('surprise:bourbon', function () { }); it('generates the correct gulpfile', function () { - assert.fileContent('gulpfile.js', 'bourbon = require(\'bourbon\')'); - assert.fileContent('gulpfile.js', 'neat = require(\'bourbon-neat\')'); - assert.fileContent('gulpfile.js', '{includePaths: bourbon.includePaths.concat(neat.includePaths)}'); + assert.fileContent('gulp-tasks/styles.js', "import bourbon from 'bourbon';"); + assert.fileContent('gulp-tasks/styles.js', "import neat from 'bourbon-neat';"); + assert.fileContent('gulp-tasks/styles.js', '{includePaths: bourbon.includePaths.concat(neat.includePaths)}'); }); it('generates the correct readme', function () { @@ -33,15 +33,15 @@ describe('surprise:bourbon', function () { }); it('generates the correct scss', function () { - assert.fileContent(docRoot+'/assets/scss/styles.scss', '@import "bourbon";'); - assert.fileContent(docRoot+'/assets/scss/styles.scss', '@import "neat-settings";'); - assert.fileContent(docRoot+'/assets/scss/styles.scss', '@import "neat";'); - assert.fileContent(docRoot+'/assets/scss/styles.scss', '@import "grid";'); - assert.fileContent(docRoot+'/assets/scss/modules/_forms.scss', '#{$all-text-inputs}'); - assert.fileContent(docRoot+'/assets/scss/modules/_forms.scss', '#{$all-text-inputs-focus}'); - assert.fileContent(docRoot+'/assets/scss/modules/_styleguide.scss', 'Bourbon Neat Style Guide styles'); - assert.file(docRoot+'/assets/scss/_grid.scss'); - assert.file(docRoot+'/assets/scss/_neat-settings.scss'); + assert.fileContent('source/scss/styles.scss', '@import "bourbon";'); + assert.fileContent('source/scss/styles.scss', '@import "neat-settings";'); + assert.fileContent('source/scss/styles.scss', '@import "neat";'); + assert.fileContent('source/scss/styles.scss', '@import "grid";'); + assert.fileContent('source/scss/modules/_forms.scss', '#{$all-text-inputs}'); + assert.fileContent('source/scss/modules/_forms.scss', '#{$all-text-inputs-focus}'); + assert.fileContent('source/scss/modules/_styleguide.scss', 'Bourbon Neat Style Guide styles'); + assert.file('source/scss/_grid.scss'); + assert.file('source/scss/_neat-settings.scss'); }); describe('with style guide', function () { @@ -76,10 +76,10 @@ describe('surprise:bourbon', function () { assert.noFileContent('package.json', '"bourbon-neat": "^1.8.0"'); }); - it('is not required in the gulpfile', function () { - assert.noFileContent('gulpfile.js', 'bourbon = require(\'bourbon\')'); - assert.noFileContent('gulpfile.js', 'neat = require(\'bourbon-neat\')'); - assert.noFileContent('gulpfile.js', '{includePaths: bourbon.includePaths.concat(neat.includePaths)}'); + it('is not required in the gulp task', function () { + assert.noFileContent('gulp-tasks/styles.js', "import bourbon from 'bourbon';"); + assert.noFileContent('gulp-tasks/styles.js', "import neat from 'bourbon-neat';"); + assert.noFileContent('gulp-tasks/styles.js', '{includePaths: bourbon.includePaths.concat(neat.includePaths)}'); }); it('is not included in the readme', function () { @@ -87,15 +87,15 @@ describe('surprise:bourbon', function () { }); it('does not generate scss', function () { - assert.noFileContent(docRoot+'/assets/scss/styles.scss', '@import "bourbon";'); - assert.noFileContent(docRoot+'/assets/scss/styles.scss', '@import "neat-settings";'); - assert.noFileContent(docRoot+'/assets/scss/styles.scss', '@import "neat";'); - assert.noFileContent(docRoot+'/assets/scss/styles.scss', '@import "grid";'); - assert.noFileContent(docRoot+'/assets/scss/modules/_forms.scss', '#{$all-text-inputs}'); - assert.noFileContent(docRoot+'/assets/scss/modules/_forms.scss', '#{$all-text-inputs-focus}'); - assert.noFileContent(docRoot+'/assets/scss/modules/_styleguide.scss', 'Bourbon Neat Style Guide styles'); - assert.noFile(docRoot+'/assets/scss/_grid.scss'); - assert.noFile(docRoot+'/assets/scss/_neat-settings.scss'); + assert.noFileContent('source/scss/styles.scss', '@import "bourbon";'); + assert.noFileContent('source/scss/styles.scss', '@import "neat-settings";'); + assert.noFileContent('source/scss/styles.scss', '@import "neat";'); + assert.noFileContent('source/scss/styles.scss', '@import "grid";'); + assert.noFileContent('source/scss/modules/_forms.scss', '#{$all-text-inputs}'); + assert.noFileContent('source/scss/modules/_forms.scss', '#{$all-text-inputs-focus}'); + assert.noFileContent('source/scss/modules/_styleguide.scss', 'Bourbon Neat Style Guide styles'); + assert.noFile('source/scss/_grid.scss'); + assert.noFile('source/scss/_neat-settings.scss'); }); }); }); \ No newline at end of file diff --git a/test/default.js b/test/default.js index a2410cd..3cb59e4 100644 --- a/test/default.js +++ b/test/default.js @@ -20,7 +20,7 @@ describe('surprise:default-framework', function () { }); it('creates the correct styleguide scss', function () { - assert.fileContent(docRoot + '/assets/scss/modules/_styleguide.scss', 'Default Styleguide SCSS'); + assert.fileContent('source/scss/modules/_styleguide.scss', 'Default Styleguide SCSS'); }); it('creates the correct styleguide document', function () { diff --git a/test/foundation.js b/test/foundation.js index 48b1e7a..bf30cd1 100644 --- a/test/foundation.js +++ b/test/foundation.js @@ -26,11 +26,11 @@ describe('surprise:foundation', function () { }); it('generates the correct scss files', function () { - assert.fileContent(docRoot+'/assets/scss/styles.scss', '@import "vendor/settings";'); - assert.fileContent(docRoot+'/assets/scss/styles.scss', '@import "vendor/foundation";'); - assert.fileContent(docRoot+'/assets/scss/modules/_styleguide.scss', 'Style guide styles for Foundation 6'); - assert.file(docRoot+'/assets/scss/vendor/_foundation.scss'); - assert.file(docRoot+'/assets/scss/vendor/_settings.scss'); + assert.fileContent('source/scss/styles.scss', '@import "vendor/settings";'); + assert.fileContent('source/scss/styles.scss', '@import "vendor/foundation";'); + assert.fileContent('source/scss/modules/_styleguide.scss', 'Style guide styles for Foundation 6'); + assert.file('source/scss/vendor/_foundation.scss'); + assert.file('source/scss/vendor/_settings.scss'); }); describe('with style guide', function () { @@ -69,11 +69,11 @@ describe('surprise:foundation', function () { }); it('does not generates the scss', function () { - assert.noFileContent(docRoot+'/assets/scss/styles.scss', '@import "vendor/settings";'); - assert.noFileContent(docRoot+'/assets/scss/styles.scss', '@import "vendor/foundation";'); - assert.noFileContent(docRoot+'/assets/scss/modules/_styleguide.scss', 'Style guide styles for Foundation 6'); - assert.noFile(docRoot+'/assets/scss/vendor/_foundation.scss'); - assert.noFile(docRoot+'/assets/scss/vendor/_settings.scss'); + assert.noFileContent('source/scss/styles.scss', '@import "vendor/settings";'); + assert.noFileContent('source/scss/styles.scss', '@import "vendor/foundation";'); + assert.noFileContent('source/scss/modules/_styleguide.scss', 'Style guide styles for Foundation 6'); + assert.noFile('source/scss/vendor/_foundation.scss'); + assert.noFile('source/scss/vendor/_settings.scss'); }); }); }); \ No newline at end of file diff --git a/test/general.js b/test/general.js index c8fdc21..c38e2a7 100644 --- a/test/general.js +++ b/test/general.js @@ -23,12 +23,13 @@ describe('surprise:generator', function () { 'public_html/', 'public_html/assets', 'public_html/assets/components', - 'public_html/assets/css', + 'public_html/assets/dist', + 'public_html/assets/dist/css', + 'public_html/assets/dist/js', 'public_html/assets/img', - 'public_html/assets/js', - 'public_html/assets/js/build', - 'public_html/assets/scss', 'public_html/assets/vendor', + 'source/js', + 'source/scss', 'public_html/mockups', 'public_html/mockups/_includes', ]); @@ -37,9 +38,10 @@ describe('surprise:generator', function () { it('creates expected files', function () { assert.file([ 'package.json', - 'gulpfile.js', + 'gulpfile.babel.js', 'bower.json', 'README.md', + '.babelrc', '.bowerrc', '.editorconfig', '.gitattributes', @@ -55,14 +57,14 @@ describe('surprise:generator', function () { 'public_html/robots.txt', 'public_html/tile-wide.png', 'public_html/tile.png', - 'public_html/assets/scss/_mixins.scss', - 'public_html/assets/scss/styles.scss', - 'public_html/assets/scss/_base.scss', - 'public_html/assets/scss/_variables.scss', - 'public_html/assets/scss/modules/_forms.scss', - 'public_html/assets/scss/modules/_buttons.scss', - 'public_html/assets/scss/modules/_footer.scss', - 'public_html/assets/scss/modules/_header.scss' + 'source/scss/_mixins.scss', + 'source/scss/styles.scss', + 'source/scss/_base.scss', + 'source/scss/_variables.scss', + 'source/scss/modules/_forms.scss', + 'source/scss/modules/_buttons.scss', + 'source/scss/modules/_footer.scss', + 'source/scss/modules/_header.scss' ]); }); }); \ No newline at end of file diff --git a/test/project-name.js b/test/project-name.js index b7a3f91..c537a2c 100644 --- a/test/project-name.js +++ b/test/project-name.js @@ -35,7 +35,7 @@ describe('surprise:project-name', function () { }); it('generates the same pascal case name in every file', function () { - assert.fileContent('public_html/assets/js/common.js', pascalName); - assert.fileContent('public_html/assets/js/site.js', pascalName); + assert.fileContent('source/js/common.js', pascalName); + assert.fileContent('source/js/site.js', pascalName); }); }); \ No newline at end of file diff --git a/test/styleguide.js b/test/styleguide.js index c27b992..976e89a 100644 --- a/test/styleguide.js +++ b/test/styleguide.js @@ -24,11 +24,11 @@ describe('surprise:styleguide', function () { }); it('imports a style guide scss module', function () { - assert.fileContent(docRoot + '/assets/scss/styles.scss', '@import "modules/styleguide";'); + assert.fileContent('source/scss/styles.scss', '@import "modules/styleguide";'); }); it('creates a style guide scss module', function () { - assert.file(docRoot + '/assets/scss/modules/_styleguide.scss'); + assert.file('source/scss/modules/_styleguide.scss'); }); it('creates a style guide document', function () { @@ -48,11 +48,11 @@ describe('surprise:styleguide', function () { }); it('does not import a style guide scss module', function () { - assert.noFileContent(docRoot + '/assets/scss/styles.scss', '@import "modules/styleguide";'); + assert.noFileContent('source/scss/styles.scss', '@import "modules/styleguide";'); }); it('does not create style guide scss module', function () { - assert.noFile(docRoot + '/assets/scss/modules/_styleguide.scss'); + assert.noFile('source/scss/modules/_styleguide.scss'); }); it('does not create a style guide document', function () { From 64bec027b57772abff3ac42077cad081ab9ddfb8 Mon Sep 17 00:00:00 2001 From: Rob Knecht Date: Fri, 8 Dec 2017 15:31:15 -0600 Subject: [PATCH 2/6] Remove extraneous paths --- generators/app/templates/_gulpfile.babel.js | 27 +-------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/generators/app/templates/_gulpfile.babel.js b/generators/app/templates/_gulpfile.babel.js index 78a9dfe..b62b73a 100644 --- a/generators/app/templates/_gulpfile.babel.js +++ b/generators/app/templates/_gulpfile.babel.js @@ -4,8 +4,6 @@ */ -/* Common paths */ - // Enter the proxy url running your local php server const local_proxy = '<%= appName %>.dev'; @@ -73,27 +71,4 @@ gulp.task('watch', function() { // Our default gulp tasks. -gulp.task('default', ['dist', 'watch'], function(){}); - -/* - - Generated on <%= date %> using <%= genName %> <%= genVersion %> - -*/ - -/* Common paths */ -var http_path = '<%= docRoot %>', - asset_path = http_path + '/assets', - css_dir = asset_path + '/css', - scss_dir = asset_path + '/scss', - images_dir = asset_path + '/img', - js_dir = asset_path + '/js', - js_build_dir = asset_path + '/js/build'; - -/* JavaScript asset paths. */ -var js_assets = [ - asset_path + '/components/jquery-placeholder/jquery.placeholder.min.js', - js_dir + '/plugins.js', - js_dir + '/common.js', - js_dir + '/site.js' -]; \ No newline at end of file +gulp.task('default', ['dist', 'watch'], function(){}); \ No newline at end of file From a54212948d8f14dbfaf74a18bec0c55e3c5cc154 Mon Sep 17 00:00:00 2001 From: Rob Knecht Date: Fri, 8 Dec 2017 15:54:33 -0600 Subject: [PATCH 3/6] Add test for gulp tasks --- test/general.js | 5 +++-- test/gulp-tasks.js | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 test/gulp-tasks.js diff --git a/test/general.js b/test/general.js index c38e2a7..f66ce8c 100644 --- a/test/general.js +++ b/test/general.js @@ -28,10 +28,11 @@ describe('surprise:generator', function () { 'public_html/assets/dist/js', 'public_html/assets/img', 'public_html/assets/vendor', - 'source/js', - 'source/scss', 'public_html/mockups', 'public_html/mockups/_includes', + 'source/js', + 'source/scss', + 'gulp-tasks' ]); }); diff --git a/test/gulp-tasks.js b/test/gulp-tasks.js new file mode 100644 index 0000000..bf97835 --- /dev/null +++ b/test/gulp-tasks.js @@ -0,0 +1,32 @@ +'use strict'; + +var path = require('path'); +var assert = require('yeoman-generator').assert; +var helpers = require('yeoman-generator').test; + +const docRoot = 'public_html'; + +describe('surprise:gulp-tasks', function () { + before(function (done) { + helpers.run(path.join(__dirname, '../generators/app')) + .withPrompts({ + docRoot: docRoot + }) + .on('end', done); + }); + + it('creates expected files', function () { + assert.file([ + 'gulp-tasks/bower.js', + 'gulp-tasks/clean.js', + 'gulp-tasks/dist.js', + 'gulp-tasks/paths.js', + 'gulp-tasks/scripts.js', + 'gulp-tasks/styles.js' + ]); + }); + + it('uses the correct document root directory within gulp tasks', function () { + assert.fileContent('gulp-tasks/paths.js', docRoot); + }); +}); \ No newline at end of file From 7b11c4d857943965b39bd9b9050d9d5874b15b99 Mon Sep 17 00:00:00 2001 From: Rob Knecht Date: Fri, 8 Dec 2017 16:18:45 -0600 Subject: [PATCH 4/6] Remove placeholder polyfill --- generators/app/templates/js/common.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/generators/app/templates/js/common.js b/generators/app/templates/js/common.js index a576aa6..863b582 100644 --- a/generators/app/templates/js/common.js +++ b/generators/app/templates/js/common.js @@ -4,9 +4,6 @@ $('html').removeClass('no-js').addClass('js'); - // Placeholder polyfill - $('input, textarea').placeholder(); - <%= pascalName %>.common.init(); }); From 9fd08ca93517990191b195573681fd0411020a23 Mon Sep 17 00:00:00 2001 From: Rob Knecht Date: Fri, 8 Dec 2017 16:29:26 -0600 Subject: [PATCH 5/6] Fix styleguide site js path --- generators/app/templates/styleguide/styleguide-bootstrap.php | 2 +- generators/app/templates/styleguide/styleguide-default.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/generators/app/templates/styleguide/styleguide-bootstrap.php b/generators/app/templates/styleguide/styleguide-bootstrap.php index eca32ce..dcb67f9 100644 --- a/generators/app/templates/styleguide/styleguide-bootstrap.php +++ b/generators/app/templates/styleguide/styleguide-bootstrap.php @@ -417,6 +417,6 @@ - + \ No newline at end of file diff --git a/generators/app/templates/styleguide/styleguide-default.php b/generators/app/templates/styleguide/styleguide-default.php index 3c19728..30f8449 100644 --- a/generators/app/templates/styleguide/styleguide-default.php +++ b/generators/app/templates/styleguide/styleguide-default.php @@ -413,6 +413,6 @@ - + \ No newline at end of file From 5699d7f0fd9b413d5cf2d12b4a71a301b13fb69e Mon Sep 17 00:00:00 2001 From: Rob Knecht Date: Fri, 8 Dec 2017 16:51:11 -0600 Subject: [PATCH 6/6] set update notifier check interval to 0 --- generators/app/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generators/app/index.js b/generators/app/index.js index 3653140..73fb6d2 100644 --- a/generators/app/index.js +++ b/generators/app/index.js @@ -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});