From 587477d45304e79f0630e61723c579c724679a32 Mon Sep 17 00:00:00 2001 From: Mark Jaquith Date: Tue, 12 Jul 2022 21:57:16 -0400 Subject: [PATCH 1/2] Trim trailing whitespace --- src/hooks.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/hooks.js b/src/hooks.js index a48d3a9..7e1a9c8 100644 --- a/src/hooks.js +++ b/src/hooks.js @@ -4,19 +4,19 @@ const fs = require('fs-extra'); const os = require('os'); /** - * Hooks! - * + * Hooks! + * * Lifecycle hooks are the backbone of how you can have complete control over the output of your site. - * Hooks are enforced via the hookInterface 'contract' defined here: + * Hooks are enforced via the hookInterface 'contract' defined here: https://github.com/Elderjs/elderjs/blob/master/src/hookInterface/hookInterface.ts * * If you read the hookInterface spec closely you'll see that each defined hook gets specific 'props' along with which of those props is 'mutable'. - * - * If you're a fan of 'pure' functions in JS, mutating props will probably set off alarm bells in your head. Fear not, instead of burying + * + * If you're a fan of 'pure' functions in JS, mutating props will probably set off alarm bells in your head. Fear not, instead of burying * what is mutating things deep in your application, you'll know it is probably in this file. * - * Also, to help keep mutation predictable each 'hook' limits which 'props' can be manipulated and where. - * + * Also, to help keep mutation predictable each 'hook' limits which 'props' can be manipulated and where. + * */ const hooks = [ From c23be2771861bb2a305825b35590da04cba8d5be Mon Sep 17 00:00:00 2001 From: Mark Jaquith Date: Tue, 12 Jul 2022 21:58:25 -0400 Subject: [PATCH 2/2] Do not exclude extensionless files from assets-to-public sync fixes #26 --- src/hooks.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/hooks.js b/src/hooks.js index 7e1a9c8..25bf3ac 100644 --- a/src/hooks.js +++ b/src/hooks.js @@ -47,14 +47,10 @@ const hooks = [ // copy assets folder to public destination glob.sync(path.resolve(settings.rootDir, './assets/**/*')).forEach((file) => { - const parsed = path.parse(file); - // Only write the file/folder structure if it has an extension - if (parsed.ext && parsed.ext.length > 0) { - const relativeToAssetsFolder = path.relative(path.join(settings.rootDir, './assets'), file); - const outputPath = path.resolve(settings.distDir, relativeToAssetsFolder); - fs.ensureDirSync(path.parse(outputPath).dir); - fs.outputFileSync(outputPath, fs.readFileSync(file)); - } + const relativeToAssetsFolder = path.relative(path.join(settings.rootDir, './assets'), file); + const outputPath = path.resolve(settings.distDir, relativeToAssetsFolder); + fs.ensureDirSync(path.parse(outputPath).dir); + fs.outputFileSync(outputPath, fs.readFileSync(file)); }); }, },