// - - - - - - - - - - - - - - -
var gulp = require('gulp'),
+ watch = require('gulp-watch'),
sass = require('gulp-ruby-sass'),
html2txt = require('gulp-html2txt'),
inlineCss = require('gulp-inline-css'),
.pipe(connect.reload())
});
-// Inject html partials into default page
-gulp.task('inject-html', function() {
- omglob(dirs.temp + '/*.html', function(er, files) {
- for (var i = 0; i < files.length; i++) {
- var filePath = files[i].replace(/\\/g, '/');
- var fileName = filePath.substring(filePath.lastIndexOf('/')+1, filePath.lastIndexOf('.'));
-
- gulp.src(dirs.src + '/layouts/default.html')
- .pipe(inject(gulp.src(files[i]), {
- starttag: '<!-- inject:page:{{ext}} -->',
- transform: function (filePath, file) {
- // return file contents as string
- return file.contents.toString('utf8')
- }
- }))
- .pipe(rename({
- basename: fileName
- }))
- .pipe(gulp.dest(dirs.dist));
- }
- })
-});
-
// Inject handlebars partials
-gulp.task('inject-handlebars', function() {
+gulp.task('compile-html', function() {
omglob(dirs.src + '/pages/*.handlebars', function(er, files) {
.pipe(gulp.dest(dirs.temp));
}
})
-});
-gulp.task('compile', function() {
- runOrder('clean:temp', 'inject-handlebars', function() {
- // better way to do this?
- setTimeout(function() {
- gulp.start('inject-html')
- }, 50);
- });
-})
+ // silly gulp asynch. The previous task sometimes happens too fast, so it can't find
+ // the new temporary partials
+ setTimeout(function() {
+ omglob(dirs.temp + '/*.html', function(er, files) {
+ for (var i = 0; i < files.length; i++) {
+ var filePath = files[i].replace(/\\/g, '/');
+ var fileName = filePath.substring(filePath.lastIndexOf('/')+1, filePath.lastIndexOf('.'));
+
+ gulp.src(dirs.src + '/layouts/default.html')
+ .pipe(inject(gulp.src(files[i]), {
+ starttag: '<!-- inject:page:{{ext}} -->',
+ transform: function (filePath, file) {
+ // return file contents as string
+ return file.contents.toString('utf8')
+ }
+ }))
+ .pipe(rename({
+ basename: fileName
+ }))
+ .pipe(gulp.dest(dirs.temp))
+ }
+ })
+ }, 100);
+});
// 6. Syntax Transformer
// - - - - - - - - - - - - - - -
// get the HTML from the body and run it through Inky parser
-gulp.task('query', function() {
- gulp.src(dirs.dist + '/*.html')
+gulp.task('query', ['compile-html'], function() {
+ gulp.src(dirs.temp + '/*.html')
.pipe(inkyGulp())
.pipe(gulp.dest(dirs.dist))
.pipe(connect.reload());
// 8. GO FORTH AND BUILD
// - - - - - - - - - - - - - - -
+
// Wipes build folder, then compiles SASS, then minifies and copies HTML
-gulp.task('build', ['clean:dist', 'sass', 'query'], function() {
- gulp.start('minify-html');
+gulp.task('build', function() {
+ runOrder('clean:dist', 'sass','query','minify-html');
});
// 9. Serve/Watch Tasks
// Watch all HTML files and SCSS files for changes
// Live reloads on change
gulp.task('watch', ['serve'], function() {
- gulp.watch([dirs.src], ['compile','query','minify-html']);
+ gulp.watch([dirs.src + '/*/*.*'], function(event) {
+ runOrder('query', 'minify-html');
+ });
gulp.watch([dirs.styles], ['sass']);
+ // watch([dirs.dist + '/*.*']).pipe(connect.reload());
+ gulp.watch([dirs.dist + '/*.*'], function(event) {
+ gulp.src(event.path)
+ .pipe(connect.reload());
+ })
+
});
-<row>
- <h1>Hello!</h1>
-</row>
-{{> header }}
\ No newline at end of file
+{{> header }}
+<container>
+ <row>
+ <columns large='12'>
+ <h1>Welcome, Daneel Olivan</h1>
+ <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et.</p>
+ <img width="580" height="300" src="http://placehold.it/580x300">
+ </columns>
+ </row>
+ <row>
+ <columns large='12'>
+ <callout>
+ <p>Phasellus dictum sapien a neque luctus cursus. Pellentesque sem dolor, fringilla et pharetra vitae. <a href="#">Click it! ยป</a></p>
+ </callout>
+ </columns>
+ </row>
+ <row>
+ <columns large='6'>
+ <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et. Lorem ipsum dolor sit amet.</p>
+
+ <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et. Lorem ipsum dolor sit amet.</p>
+ <button><a href="#">Click Me!</a></button>
+ </columns>
+ <columns large='6'>
+ <callout>
+ <h6>Header Thing</h6>
+ <p>Sub-head or something</p>
+ <inline-list-v>
+ <a href="#">Just a Plain Link »</a>
+ <a href="#">Just a Plain Link »</a>
+ <a href="#">Just a Plain Link »</a>
+ <hr>
+ <a href="#">Just a Plain Link »</a>
+ <hr>
+ <a href="#">Just a Plain Link »</a>
+ <hr>
+ <a href="#">Just a Plain Link »</a>
+ <hr>
+ <a href="#">Just a Plain Link »</a>
+ </inline-list-v>
+ </callout>
+ </columns>
+ </row>
+ <row>
+ <columns large='6'>
+ </columns>
+ <columns large='6'>
+ <callout>
+ <h6 style="margin-bottom:5px;">Connect With Us:</h6>
+ <button class="tiny-button facebook">
+ <a href='#'>Facebook</a>
+ </button>
+ <hr>
+ <button class="tiny-button twitter">
+ <a href='#'>Twitter</a>
+ </button>
+ <hr>
+ <button class="tiny-button google-plus">
+ <a href='#'>Google</a>
+ </button>
+ <br>
+ <h6 style="margin-bottom:5px;">Contact Info:</h6>
+ <p>Phone: <b>408.341.0600</b></p>
+ <p>Email: <a href="mailto:hseldon@trantor.com">hseldon@trantor.com</a></p>
+ </callout>
+ </columns>
+ </row>
+ </container>
+ {{> footer }}