diff --git a/assets/sass/_base.sass b/assets/sass/_base.sass index e4cb3ad9..2fc67244 100644 --- a/assets/sass/_base.sass +++ b/assets/sass/_base.sass @@ -10,6 +10,9 @@ main img @extend .img-responsive + p img + margin: 1.5em 0 + .embed-container padding: 56.25% 0 0 position: relative diff --git a/assets/sass/components/_page-about.sass b/assets/sass/about.sass similarity index 100% rename from assets/sass/components/_page-about.sass rename to assets/sass/about.sass diff --git a/assets/sass/base/_code.sass b/assets/sass/base/_code.sass deleted file mode 100644 index b673dc10..00000000 --- a/assets/sass/base/_code.sass +++ /dev/null @@ -1,17 +0,0 @@ -pre - display: block - overflow: auto - word-break: normal - word-wrap: no-wrap - -pre[class*="language-"] - border: 0 - border-radius: 0 - -pre code - white-space: pre - word-break: normal - -code.hljs - background-color: inherit - padding: 0 diff --git a/assets/sass/blog-post.sass b/assets/sass/blog-post.sass new file mode 100644 index 00000000..8ceb2bd1 --- /dev/null +++ b/assets/sass/blog-post.sass @@ -0,0 +1,39 @@ +@import '../../vendor/bower_components/bootstrap-sass/assets/stylesheets/bootstrap/mixins/clearfix' + +.post-pager + clear: both + margin-top: 2em + +.post-pager div + flex: 1 + +pre + display: block + overflow: auto + word-break: normal + word-wrap: no-wrap + +pre[class*="language-"] + border: 0 + border-radius: 0 + margin: 1.5em 0 + +pre code + white-space: pre + word-break: normal + +code.hljs + background-color: inherit + padding: 0 + +code[data-gist-id] + background: transparent + padding: 0 + +.about-author + +clearfix + + img + float: left + margin: 0 1em 1em 0 + width: 50px diff --git a/assets/sass/components/_blog-list.sass b/assets/sass/blog.sass similarity index 69% rename from assets/sass/components/_blog-list.sass rename to assets/sass/blog.sass index 765521a1..674bdfc6 100644 --- a/assets/sass/components/_blog-list.sass +++ b/assets/sass/blog.sass @@ -1,3 +1,5 @@ +@import '../../vendor/bower_components/bootstrap-sass/assets/stylesheets/bootstrap/mixins/clearfix' + .page--blog__list ul.posts list-style: none diff --git a/assets/sass/components/_about-author.sass b/assets/sass/components/_about-author.sass index 1c6eeeef..e69de29b 100644 --- a/assets/sass/components/_about-author.sass +++ b/assets/sass/components/_about-author.sass @@ -1,7 +0,0 @@ -.about-author - +clearfix - - img - float: left - margin: 0 1em 1em 0 - width: 50px diff --git a/assets/sass/components/_page-experience.sass b/assets/sass/experience.sass similarity index 70% rename from assets/sass/components/_page-experience.sass rename to assets/sass/experience.sass index f278674e..202ba3d6 100644 --- a/assets/sass/components/_page-experience.sass +++ b/assets/sass/experience.sass @@ -1,3 +1,7 @@ +@import '../../vendor/bower_components/bootstrap-sass/assets/stylesheets/bootstrap/mixins/clearfix' +@import '../../vendor/bower_components/bootstrap-sass/assets/stylesheets/bootstrap/variables' +@import 'mixins' + .experience-item margin-bottom: $padding-large-vertical * 3 +clearfix diff --git a/assets/sass/main.sass b/assets/sass/main.sass new file mode 100644 index 00000000..7d476575 --- /dev/null +++ b/assets/sass/main.sass @@ -0,0 +1,12 @@ +@import '../../vendor/bower_components/bootstrap-sass/assets/stylesheets/bootstrap' + +@import 'base' +@import 'mixins' + +@import 'base/layout' +@import 'base/typography' + +@import 'components/availability' +@import 'components/badges' +@import 'components/footer' +@import 'components/meetups' diff --git a/assets/sass/components/_project-company.sass b/assets/sass/project.sass similarity index 70% rename from assets/sass/components/_project-company.sass rename to assets/sass/project.sass index 523b1f9d..516cfd9c 100644 --- a/assets/sass/components/_project-company.sass +++ b/assets/sass/project.sass @@ -1,3 +1,6 @@ +@import '../../vendor/bower_components/bootstrap-sass/assets/stylesheets/bootstrap/variables' +@import 'mixins' + .project-company &.has-logo a:link, diff --git a/assets/sass/site.sass b/assets/sass/site.sass deleted file mode 100644 index ad5f732d..00000000 --- a/assets/sass/site.sass +++ /dev/null @@ -1,21 +0,0 @@ -@import '../../vendor/bower_components/bootstrap-sass/assets/stylesheets/bootstrap' - -@import 'base' -@import 'mixins' - -@import 'base/layout' -@import 'base/typography' -@import 'base/code' - -@import 'components/about-author' -@import 'components/availability' -@import 'components/badges' -@import 'components/blog-list' -@import 'components/footer' -@import 'components/meetups' -@import 'components/page-about' -@import 'components/page-post' -@import 'components/page-experience' -@import 'components/page-talk' -@import 'components/project-company' -@import 'components/testimonials' diff --git a/assets/sass/talk.sass b/assets/sass/talk.sass new file mode 100644 index 00000000..3c048396 --- /dev/null +++ b/assets/sass/talk.sass @@ -0,0 +1,14 @@ +@import '../../vendor/bower_components/bootstrap-sass/assets/stylesheets/bootstrap/variables' +@import 'mixins' + +.talk-full h1 + margin-bottom: 25px + +.presentation + background: url('../images/loading.gif') no-repeat center + min-height: 275px + width: 100% + +tablet + min-height: 460px + +desktop + min-height: 540px diff --git a/assets/sass/components/_page-talk.sass b/assets/sass/talks-table.sass similarity index 57% rename from assets/sass/components/_page-talk.sass rename to assets/sass/talks-table.sass index d11b6f7d..5bdfe99c 100644 --- a/assets/sass/components/_page-talk.sass +++ b/assets/sass/talks-table.sass @@ -1,15 +1,3 @@ -.talk-full h1 - margin-bottom: 25px - -.presentation - background: url('../images/loading.gif') no-repeat center - min-height: 275px - width: 100% - +tablet - min-height: 460px - +desktop - min-height: 540px - .talk-event-table & > thead > tr > th, & > tbody > tr > td diff --git a/assets/sass/components/_testimonials.sass b/assets/sass/testimonials.sass similarity index 53% rename from assets/sass/components/_testimonials.sass rename to assets/sass/testimonials.sass index eaca8768..1cbaff0a 100644 --- a/assets/sass/components/_testimonials.sass +++ b/assets/sass/testimonials.sass @@ -1,3 +1,7 @@ +@import '../../vendor/bower_components/bootstrap-sass/assets/stylesheets/bootstrap/mixins/clearfix' +@import '../../vendor/bower_components/bootstrap-sass/assets/stylesheets/bootstrap/variables' +@import 'mixins' + .testimonial +clearfix margin-bottom: 10px diff --git a/gulpfile.js b/gulpfile.js index 024d8fb5..b92db22b 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -20,12 +20,10 @@ var config = { } }; -gulp.task('styles', function () { - return gulp.src([ - config.bowerDir + '/font-awesome/css/font-awesome.css', - config.bowerDir + '/prism/themes/prism-twilight.css', - config.sass.sourceDir + config.sass.pattern - ]) +var app = {}; + +app.sass = function (sourceFiles, filename) { + return gulp.src(sourceFiles) .pipe(plugins.plumber()) .pipe(plugins.if(!config.production, plugins.sourcemaps.init())) .pipe(plugins.sassGlob()) @@ -34,7 +32,7 @@ gulp.task('styles', function () { browsers: ["last 2 versions", "> 5%"], cascade: false })) - .pipe(plugins.concat('site.css')) + .pipe(plugins.concat(filename)) .pipe(plugins.if(config.production, plugins.purifycss([ 'source/**/*.html', 'source/**/*.md', @@ -44,6 +42,25 @@ gulp.task('styles', function () { .pipe(plugins.if(!config.production, plugins.sourcemaps.write('.'))) .pipe(plugins.if(!config.production, plugins.refresh())) .pipe(gulp.dest(config.sass.outputDir)); +} + +gulp.task('styles', function () { + app.sass([ + config.bowerDir + '/font-awesome/css/font-awesome.css', + config.sass.sourceDir + '/main.sass' + ], 'main.css'); + + app.sass(config.sass.sourceDir + '/about.sass', 'about.css'); + app.sass(config.sass.sourceDir + '/blog.sass', 'blog.css'); + app.sass([ + config.bowerDir + '/prism/themes/prism-twilight.css', + config.sass.sourceDir + '/blog-post.sass' + ], 'blog-post.css'); + app.sass(config.sass.sourceDir + '/experience.sass', 'experience.css'); + app.sass(config.sass.sourceDir + '/project.sass', 'project.css'); + app.sass(config.sass.sourceDir + '/talk.sass', 'talk.css'); + app.sass(config.sass.sourceDir + '/talks-table.sass', 'talks-table.css'); + app.sass(config.sass.sourceDir + '/testimonials.sass', 'testimonials.css'); }); gulp.task('scripts', function () { diff --git a/source/_partials/head.twig b/source/_partials/head.twig index 6a947642..e69de29b 100644 --- a/source/_partials/head.twig +++ b/source/_partials/head.twig @@ -1,24 +0,0 @@ - - {% include 'title' %} - - - - - - {% if page.meta.description %} - - {% endif %} - - {% include 'og' with { og: page.meta.og } %} - - - {% block styles %}{% endblock %} - - {% for size in site.apple_touch_icon_sizes %} - - {% endfor %} - - {% for size in site.favicon_sizes %} - - {% endfor %} - diff --git a/source/_posts/2017-05-20-turning-your-custom-drupal-module-into-a-feature.md b/source/_posts/2017-05-20-turning-your-custom-drupal-module-into-a-feature.md new file mode 100644 index 00000000..45741e64 --- /dev/null +++ b/source/_posts/2017-05-20-turning-your-custom-drupal-module-into-a-feature.md @@ -0,0 +1,36 @@ +--- +title: Turning Your Custom Drupal Module into a Feature +tags: + - drupal + - drupal-7 + - drupal-planet + - features +slug: turning-drupal-module-into-feature +--- +{% block excerpt %} +Yesterday I was fixing a bug in an inherited Drupal 7 custom module, and I decided that I was going to add some tests to ensure that the bug was fixed and doesn’t get accidentially re-introduced in the future. The test though required me to have a particular content type and fields which are specific to this site, so weren’t present within the standard installation profile used to run tests. + +I decided to convert the custom module into a [Feature][0] so that the content type and it’s fields could be added to it, and therefore present on the testing site once the module is installed. + +To do this, I needed to expose the module to the Features API. +{% endblock %} + +{% block content %} +Yesterday I was fixing a bug in an inherited Drupal 7 custom module, and I decided that I was going to add some tests to ensure that the bug was fixed and doesn’t get accidentially re-introduced in the future. The test though required me to have a particular content type and fields which are specific to this site, so weren’t present within the standard installation profile used to run tests. + +I decided to convert the custom module into a [Feature][0] so that the content type and it’s fields could be added to it, and therefore present on the testing site once the module is installed. + +To do this, I needed to expose the module to the Features API. + +All that’s needed is to add this line to the `mymodule.info` file: + +```language-ini +features[features_api][] = api:2 +``` + +After clearing the cache, the module is now visible in the Features list - and ready to have the appropriate configuration added to it. + +!['The features list showing the custom module'](/assets/images/blog/custom-module-as-a-feature.png) +{% endblock %} + +[0]: https://www.drupal.org/project/features diff --git a/source/_views/default.twig b/source/_views/default.twig index 44632213..3e38807b 100644 --- a/source/_views/default.twig +++ b/source/_views/default.twig @@ -13,8 +13,8 @@ {% include 'og' with { og: page.meta.og } %} - - {% block styles %}{% endblock %} + + {% block stylesheets '' %} {% for size in site.apple_touch_icon_sizes %} @@ -62,6 +62,6 @@ {% endif %} - {% block scripts %}{% endblock %} + {% block scripts '' %} diff --git a/source/_views/post.twig b/source/_views/post.twig index c1e5a9a4..57c98f8f 100644 --- a/source/_views/post.twig +++ b/source/_views/post.twig @@ -11,3 +11,7 @@ {% include 'post/pager' %} {% include 'post/about-author' %} {% endblock %} + +{% block stylesheets %} + +{% endblock %} diff --git a/source/_views/project.twig b/source/_views/project.twig index 87e6a135..c7c424ff 100644 --- a/source/_views/project.twig +++ b/source/_views/project.twig @@ -11,3 +11,7 @@ {% include 'project/skills' %} {% include 'project/company' %} {% endblock %} + +{% block stylesheets %} + +{% endblock %} diff --git a/source/_views/talk.twig b/source/_views/talk.twig index 902a457a..ebadd65b 100644 --- a/source/_views/talk.twig +++ b/source/_views/talk.twig @@ -41,3 +41,8 @@ {% include "talks-table" with { events: events, hide_talk: true } %} {# .talk-events #} {% endblock %} + +{% block stylesheets %} + + +{% endblock %} diff --git a/source/assets/images/blog/custom-module-as-a-feature.png b/source/assets/images/blog/custom-module-as-a-feature.png new file mode 100644 index 00000000..72669173 Binary files /dev/null and b/source/assets/images/blog/custom-module-as-a-feature.png differ diff --git a/source/blog.html b/source/blog.html index 04f980d2..48799cbf 100644 --- a/source/blog.html +++ b/source/blog.html @@ -41,3 +41,7 @@ use: [posts] {% endblock %} {% block body_classes 'page--blog page--blog__list' %} + +{% block stylesheets %} + +{% endblock %} diff --git a/source/experience.twig b/source/experience.twig index 7518274f..4f2562b8 100644 --- a/source/experience.twig +++ b/source/experience.twig @@ -99,38 +99,44 @@ experiences: Maintaining and adding new features to the Horse & Country TV website (Drupal 6). use: [posts] --- -

Experience

+{% block content %} +

Experience

-{% for experience in page.experiences %} - {% set company = site.companies[experience.company] %} + {% for experience in page.experiences %} + {% set company = site.companies[experience.company] %} -