From be06409a43e2f5be67c4ebdbf036e9d6b0812579 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Wed, 30 Mar 2016 13:56:01 +0100 Subject: [PATCH] Update assets and gulpfile --- assets/sass/site.sass | 21 +++---------------- assets/sass/vendor.sass | 2 -- gulpfile.js | 34 ++++++++++++++++++++++--------- source/_includes/footer.html.twig | 2 +- 4 files changed, 28 insertions(+), 31 deletions(-) delete mode 100644 assets/sass/vendor.sass diff --git a/assets/sass/site.sass b/assets/sass/site.sass index bfdbe6d5..e861ae9e 100644 --- a/assets/sass/site.sass +++ b/assets/sass/site.sass @@ -1,21 +1,6 @@ -@import '../../vendor/bower/bootstrap-sass/assets/stylesheets/bootstrap/variables' -@import '../../vendor/bower/bootstrap-sass/assets/stylesheets/bootstrap/mixins/clearfix' -@import '../../vendor/bower/bootstrap-sass/assets/stylesheets/bootstrap/mixins/center-block' -@import '../../vendor/bower/bootstrap-sass/assets/stylesheets/bootstrap/mixins/hide-text' -@import '../../vendor/bower/bootstrap-sass/assets/stylesheets/bootstrap/mixins' -@import '../../vendor/bower/bootstrap-sass/assets/stylesheets/bootstrap/mixins/tab-focus' -@import '../../vendor/bower/bootstrap-sass/assets/stylesheets/bootstrap/mixins/image' -@import '../../vendor/bower/bootstrap-sass/assets/stylesheets/bootstrap/utilities' -@import '../../vendor/bower/bootstrap-sass/assets/stylesheets/bootstrap/scaffolding' +@import '../../vendor/bower/bootstrap-sass/assets/stylesheets/bootstrap' @import '../../vendor/bower/compass-breakpoint/stylesheets/breakpoint' @import 'base' -@import 'components/badges' -@import 'components/content-types/**' -@import 'components/footer' -@import 'components/meetups' -@import 'components/testimonials' -@import 'pages/blog-list' -@import 'pages/blog-post' -@import 'pages/experience' -@import 'pages/portfolio' +@import 'components/**/*' +@import 'pages/**/*' diff --git a/assets/sass/vendor.sass b/assets/sass/vendor.sass deleted file mode 100644 index 7fb47480..00000000 --- a/assets/sass/vendor.sass +++ /dev/null @@ -1,2 +0,0 @@ -@import '../../vendor/bower/compass-breakpoint/stylesheets/breakpoint' -@import '../../vendor/bower/bootstrap-sass/assets/stylesheets/bootstrap' diff --git a/gulpfile.js b/gulpfile.js index d366d21e..675d892a 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -4,7 +4,10 @@ var del = require('del'); var config = { assetsDir: './assets', + bowerDir: './vendor/bower', + outputDir: './source/assets', sassPattern: './assets/sass/**/*.sass', + jsPattern: 'js/**/*.js', production: !!plugins.util.env.production, sourceMaps: !plugins.util.env.production, liveReload: !plugins.util.env.production @@ -22,7 +25,7 @@ app.css = function (paths, filename) { .pipe(plugins.concat(filename)) .pipe(config.production ? plugins.cleanCss() : plugins.util.noop()) .pipe(plugins.if(config.sourceMaps, plugins.sourcemaps.write('.'))) - .pipe(gulp.dest('source/assets/css')) + .pipe(gulp.dest(config.outputDir + '/css')) .pipe(plugins.if(config.liveReload, plugins.livereload())); }; @@ -34,7 +37,7 @@ app.js = function (paths, filename) { .pipe(plugins.concat(filename)) .pipe(config.production ? plugins.uglify() : plugins.util.noop()) .pipe(plugins.if(config.sourceMaps, plugins.sourcemaps.write('.'))) - .pipe(gulp.dest('source/assets/js')); + .pipe(gulp.dest(config.outputDir + '/js')); }; app.copy = function (srcFiles, outputDir) { @@ -43,17 +46,28 @@ app.copy = function (srcFiles, outputDir) { }; gulp.task('styles', function () { - app.css(config.assetsDir + '/sass/site.sass', 'site.css'); + app.css([ + config.bowerDir + '/font-awesome/css/font-awesome.css', + config.assetsDir + '/sass/site.sass', + ], 'site.css'); }); +gulp.task('scripts', function () { + app.js([ + config.bowerDir + '/jquery/dist/jquery.js', + config.bowerDir + '/bootstrap-sass/assets/javascripts/bootstrap.js', + config.assetsDir + config.jsPattern + ], 'site.js'); +}) + gulp.task('watch', function () { gulp.watch(config.sassPattern, ['styles']); - gulp.watch(config.assetsDir + '/js/**/*.js', ['scripts']); + gulp.watch(config.assetsDir + config.jsPattern, ['scripts']); }); gulp.task('clean', function () { - del.sync('output_*/assets'); - del.sync('source/assets'); + del.sync('output_*/assets/{css,fonts,images,js}'); + del.sync(config.outputDir + '/{css,fonts,images,js}'); }); gulp.task('vendor-styles', function () { @@ -74,7 +88,7 @@ gulp.task('vendor-scripts', function () { gulp.task('vendor', ['vendor-styles', 'vendor-scripts']); gulp.task('fonts', function () { - app.copy('./assets/fonts/*', './source/assets/fonts'); + app.copy(config.bowerDir + '/font-awesome/fonts/*', config.outputDir + '/fonts'); }); gulp.task('meetup-thumbnails', function () { @@ -82,16 +96,16 @@ gulp.task('meetup-thumbnails', function () { .pipe(plugins.imageResize({ height: '50' })) - .pipe(gulp.dest(config.assetsDir + '/images/meetups/thumbnails')) + .pipe(gulp.dest(config.outputDir + '/images/meetups/thumbnails')) }); gulp.task('copy-images', function () { - app.copy('./assets/images/**/*', './source/assets/images'); + app.copy(config.assetsDir + '/images/**/*', config.outputDir + '/images'); }); gulp.task('images', ['meetup-thumbnails', 'copy-images']); -gulp.task('build', ['clean', 'vendor', 'styles', 'fonts', 'images']); +gulp.task('build', ['clean', 'styles', 'scripts', 'fonts', 'images']); gulp.task('default', ['build', 'watch']); diff --git a/source/_includes/footer.html.twig b/source/_includes/footer.html.twig index 71b25a2d..f92cc00d 100644 --- a/source/_includes/footer.html.twig +++ b/source/_includes/footer.html.twig @@ -4,7 +4,7 @@ {% include('meetups') %} - + {% block scripts %}{% endblock %}