develop
HerrHase 2 years ago
parent 86a7b7c790
commit 596bea5608

@ -1,7 +1,7 @@
const path = require('path')
const fs = require('fs')
const Media = require('./media.js')
const Media = require('./../factories/media.js')
/**
* asset - checks manifest.json for given path and return
@ -13,7 +13,7 @@ const Media = require('./media.js')
*/
function asset(staticPath) {
// getting basePath
let result = staticPath

@ -1,5 +1,4 @@
const nunjucks = require('nunjucks')
const { minify } = require('html-minifier')
const fs = require('fs')
const assign = require('assign-deep')
@ -69,18 +68,6 @@ class Engine {
data = assign({}, data, this._defaults)
this.nunjucks.render(view, data, (error, response) => {
const options = configStore.get('options')
// if options minifyHtml is set, minify html
if (options.minifyHtml === true) {
response = minify(response, {
removeComments: true,
collapseWhitespace: true,
collapseInlineTagWhitespace: true
})
}
done(error, response)
})
}

@ -1,12 +1,11 @@
const path = require('path')
const fs = require('fs')
const sharp = require('sharp')
const mkdirp = require('mkdirp')
const crypto = require('crypto')
const slugify = require('slugify')
const configStore = require('./config.js')
const configStore = require('./../config.js')
/**
*
@ -20,7 +19,7 @@ class Media {
/**
*
* @param {string} srcPath
* @param {string} src
* @param {object} sizes
* @param {Object} [options={}]
* @return {string}
@ -75,7 +74,6 @@ class Media {
// change extension
this._extension = '.webp'
this._process
.webp({
lossless: true
})

@ -1,6 +1,7 @@
const fs = require('fs')
const path = require('path')
const mkdirp = require('mkdirp')
const { minify } = require('html-minifier')
const configStore = require('./config.js')
@ -80,6 +81,17 @@ class Siteomat {
return;
}
const options = configStore.get('options')
// if options minifyHtml is set, minify html
if (options.minifyHtml === true) {
content = minify(content, {
removeComments: true,
collapseWhitespace: true,
collapseInlineTagWhitespace: true
})
}
// create directories and write file = page
mkdirp(this._destination + page.pathname).then(() => {
fs.writeFileSync(this._destination + page.pathname + '/' + page.filename, content)

@ -1,4 +1,4 @@
const HappySite = require('./src/happySite.js')
const Siteomat = require('./src/siteomat.js')
const happySite = new HappySite('./example/site', './example/views', './public')
happySite.run()
const siteomat = new Siteomat('./example/site', './example/views', './public')
siteomat.run()
Loading…
Cancel
Save