diff --git a/packages/core/package.json b/packages/core/package.json index 835cf1ce7..9c941c398 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -4,6 +4,7 @@ "version": "6.0.0", "main": "./src/index.js", "dependencies": { + "@pattern-lab/engine-handlebars": "^6.0.0", "@pattern-lab/engine-mustache": "^6.0.0", "@pattern-lab/live-server": "^6.0.0", "chalk": "4.1.0", diff --git a/packages/core/src/lib/get.js b/packages/core/src/lib/get.js index 4852670eb..2f180a77f 100644 --- a/packages/core/src/lib/get.js +++ b/packages/core/src/lib/get.js @@ -35,7 +35,7 @@ module.exports = function (partialName, patternlab, reportWarning = true) { } if (reportWarning) { logger.warning( - `Could not find pattern referenced with partial syntax ${partialName}. + `Could not find pattern referenced with partial syntax "${partialName}" from "${patternlab.config.paths.source.patterns}". This can occur when a pattern was renamed, moved, or no longer exists but it still referenced within a different template or within data as a link.` ); } diff --git a/packages/edition-twig/patternlab-config.json b/packages/edition-twig/patternlab-config.json index 3907ebb47..40d5301c4 100644 --- a/packages/edition-twig/patternlab-config.json +++ b/packages/edition-twig/patternlab-config.json @@ -1,6 +1,6 @@ { "engines": { - "twig": { + "twig-php": { "package": "@pattern-lab/engine-twig-php", "fileExtensions": [ "twig" diff --git a/packages/engine-twig-php/lib/engine_twig_php.js b/packages/engine-twig-php/lib/engine_twig_php.js index d52a13ebc..0f728dc6b 100644 --- a/packages/engine-twig-php/lib/engine_twig_php.js +++ b/packages/engine-twig-php/lib/engine_twig_php.js @@ -40,13 +40,17 @@ const engine_twig_php = { usePatternLabConfig: function (config) { patternLabConfig = config; - if (!config.engines.twig) { + if (!config.engines['twig-php']) { console.error('Missing "twig" in Pattern Lab config file; exiting...'); process.exit(1); } const { namespaces, alterTwigEnv, relativeFrom, ...rest } = - config.engines.twig; + config.engines['twig-php']; + + // since package is a reserved word in node, we need to delete it from the config object like this + delete rest.package; + delete rest.fileExtensions; // Schema on config object being passed in: // https://github.com/basaltinc/twig-renderer/blob/master/config.schema.json @@ -221,10 +225,7 @@ const engine_twig_php = { // then tease out the folder name itself (including the # prefix) // ex. atoms - const folderName = fullFolderPath.substring( - fullFolderPath.lastIndexOf('/') + 1, - fullFolderPath.length - ); + const folderName = path.parse(fullFolderPath).base; // finally, return the Twig path we created from the full file path // ex. atoms/buttons/button.twig diff --git a/packages/starterkit-twig-demo/patternlab-config.json b/packages/starterkit-twig-demo/patternlab-config.json index c25133362..099f03c03 100644 --- a/packages/starterkit-twig-demo/patternlab-config.json +++ b/packages/starterkit-twig-demo/patternlab-config.json @@ -1,6 +1,6 @@ { "engines": { - "twig": { + "twig-php": { "package": "@pattern-lab/engine-twig-php", "fileExtensions": [ "twig"