Skip to content

Commit

Permalink
Include template/script.js into preprocessing pipeline; provide group…
Browse files Browse the repository at this point in the history
… clearfix method on relevant CSS templates, upgrade gulpfile and pagy-template along with meta::version property.
  • Loading branch information
marvindanig committed Sep 19, 2019
1 parent 810456d commit 9b4a9d0
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 15 deletions.
25 changes: 16 additions & 9 deletions crust/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
const del = r('del')
const delayed = r('delayed')

// Preprocessors / Transpilers
// Preprocessors / Transpilers
const haml = r('gulp-haml')
const markdown = r('gulp-markdown')
const sass = r('gulp-sass')
Expand Down Expand Up @@ -64,9 +64,9 @@
done()
}))

//*************************************//
//************ Book Indexer ***********//
//*************************************//
// *************************************//
// ************ Book Indexer ***********//
// *************************************//

gulp.task('indexPage', (done) => {
indexPageHandler()
Expand Down Expand Up @@ -109,16 +109,18 @@
const scriptPath = path.join('.', 'build', 'manuscript', page, 'script.js')
const stylePath = path.join('.', 'build', 'manuscript', page, 'style.css')
const templateStylePath = path.join('.', 'build', 'templates', 'style.css')
const templateHeadPath = path.join('.', 'build', 'templates', 'head.html')
const templateHeadPath = path.join('.', 'build', 'templates', 'head.html')
const templateScriptPath = path.join('.', 'build', 'templates', 'script.js')

let bodyContent = ''
let styleContent = ''
let templateStyleContent = ''
let scriptContent = ''
let headContent = ''
let templateHeadContent = ''
let templateScriptContent = ''
let templateStyleContent = ''

// TODO: Use promises here?
// TODO: Use promises here?

if (fs.existsSync(bodyPath)) {
bodyContent = fs.readFileSync(bodyPath, 'utf-8').toString()
Expand All @@ -138,9 +140,14 @@
}
if (fs.existsSync(scriptPath)) {
scriptContent = fs.readFileSync(scriptPath, 'utf-8').toString()
}

if (fs.existsSync(templateScriptPath)) {
templateScriptContent = fs.readFileSync(templateScriptPath, 'utf-8').toString()
}

const pageTemplateData = { bodyContent, templateStyleContent, styleContent, headContent, templateHeadContent, scriptContent }

const pageTemplateData = { bodyContent, templateStyleContent, styleContent, headContent, templateHeadContent, scriptContent, templateScriptContent }

gulp.src(path.join('.', 'crust', 'page-template.html'))
.pipe(handlebars(pageTemplateData, {}))
Expand Down Expand Up @@ -188,7 +195,7 @@
page = paths[paths.length - 1]
} else {
page = paths[paths.length - 2]
}
}
});

globWatcher.on('add', function (pagePath, stats) {
Expand Down
9 changes: 5 additions & 4 deletions crust/page-template.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta charset="UTF-8">
<meta property="bkz-version" content="1.0.1">
{{{ templateHeadContent }}}

{{{ headContent }}}
<style>
{{{ templateStyleContent }}}
Expand All @@ -12,6 +12,7 @@
</head>
<body>
{{{ bodyContent }}}
<script>{{{ scriptContent }}}</script>
<script> ((document, undefined) => { {{{ scriptContent }}} })(document)</script>
<script> ((document, undefined) => { {{{ templateScriptContent }}} })(document)</script>
</body>
</html>
</html>
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bookiza",
"version": "2.8.15",
"version": "2.9.15",
"description": "The book reification framework for the web",
"logo": {
"file": "./assets/images/bookiza.png"
Expand Down
2 changes: 1 addition & 1 deletion templates/blank/style.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
See how a working CSS template at https://github.com/bookiza/templates
Expand Down
14 changes: 14 additions & 0 deletions templates/novel/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,20 @@ hr::before {
color: black;
}

/* Clearfix*/
.group:before, .group:after {
content: "";
display: table;
}

.group:after {
clear: both;
}

.group {
zoom: 1; /* For IE 6/7 (trigger hasLayout) */
}


/* Page specific wrapper classes. */

Expand Down
14 changes: 14 additions & 0 deletions templates/novella/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,20 @@ hr::before {
color: black;
}

/* Clearfix*/
.group:before, .group:after {
content: "";
display: table;
}

.group:after {
clear: both;
}

.group {
zoom: 1; /* For IE 6/7 (trigger hasLayout) */
}


/* Page specific wrapper classes. */

Expand Down
14 changes: 14 additions & 0 deletions templates/text/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,20 @@ hr::before {
color: black;
}

/* Clearfix*/
.group:before, .group:after {
content: "";
display: table;
}

.group:after {
clear: both;
}

.group {
zoom: 1; /* For IE 6/7 (trigger hasLayout) */
}


/* Page specific wrapper classes. */

Expand Down

0 comments on commit 9b4a9d0

Please sign in to comment.