Skip to content

All _meta files being run through the mustache engine #766

@dnwhte

Description

@dnwhte

All _meta files being run through the mustache engine.

The reason is that the meta patterns have incomplete data when being rendered in https://github.com/pattern-lab/patternlab-node/blob/dev/core/lib/object_factory.js#L105 (specifically the fileExtension in this case).

Logging out the meta _00-head.njk file at the top of the render function results in:

{
    relPath: '.',
    fileName: '.',
    subdir: '',
    fileExtension: '',
    name: '-.',
    jsonFileData: {},
    patternBaseName: '.',
    patternName: '.',
    patternGroup: '',
    patternType: '',
    patternSubGroup: '',
    patternSubType: '',
    flatPatternPath: '',
    patternLink: null,
    patternPartial: '-.',
    verbosePartial: '/.',
    isPattern: true,
    isFlatPattern: true,
    patternState: '',
    template: '',
    patternPartialCode: '',
    lineage: [],
    lineageIndex: [],
    lineageR: [],
    lineageRIndex: [],
    isPseudoPattern: false,
    order: 9007199254740991,
    engine: {
        engine: {
            name: 'mustache.js',
            version: '2.3.0',
            tags: [Array],
            clearCache: [Function: clearCache],
            parse: [Function: parse],
            render: [Function: render],
            to_html: [Function: to_html],
            escape: [Function: escapeHtml],
            Scanner: [Function: Scanner],
            Context: [Function: Context],
            Writer: [Function: Writer]
        },
        engineName: 'mustache',
        engineFileExtension: '.mustache',
        isAsync: true,
        expandPartials: true,
        findPartialsRE: /{{>\s*?([\w\-\.\/~]+)(?:\:[A-Za-z0-9-_|]+)?(?:(?:| )\(.*)?(?:\s*)?}}/g,
        findPartialsWithStyleModifiersRE: /{{>\s*([\w\-\.\/~]+)(?!\()(\:[\w\-\|]+)(\s*\([^\)]*\))?\s*}}/g,
        findPartialsWithPatternParametersRE: /{{>\s*([\w\-\.\/~]+)(\:[\w\-\|]+)?(\s*\([^\)]*\))\s*}}/g,
        findListItemsRE: /{{#\s*(list(I|i)tems\.)(one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|thirteen|fourteen|fifteen|sixteen|seventeen|eighteen|nineteen|twenty)\s*}}/g,
        findPartialRE: undefined,
        renderPattern: [Function: renderPattern],
        patternMatcher: [Function: patternMatcher],
        spawnFile: [Function: spawnFile],
        spawnMeta: [Function: spawnMeta],
        findPartials: [Function: findPartials],
        findPartialsWithStyleModifiers: [Function: findPartialsWithStyleModifiers],
        findPartialsWithPatternParameters: [Function: findPartialsWithPatternParameters],
        findListItems: [Function: findListItems],
        findPartial_new: [Function: findPartial_new],
        findPartial: [Function: findPartial],
        usePatternLabConfig: [Function: usePatternLabConfig]
    },
    compileState: null,
    lastModified: null,
    extendedTemplate: '<!DOCTYPE html>\r\n<html class="{{ htmlClass }}">\r\n  <head>\r\n    <title>{{ title }}</title>\r\n    <meta charset="UTF-8">\r\n    <meta name="viewport" content="width=device-width" />\r\n\r\n    <link rel="stylesheet" href="../../css/style.css?{{ cacheBuster }}" media="all" />\r\n    <link rel="stylesheet" href="../../css/pattern-scaffolding.css?{{ cacheBuster }}" media="all" />\r\n\r\n    <!-- Begin Pattern Lab (Required for Pattern Lab to run properly) -->\r\n    {{ patternLabHead | safe }}\r\n    {% raw %}{{ patternLabHead }}{% endraw %}\r\n    <!-- End Pattern Lab -->\r\n\r\n  </head>\r\n  <body class="{{ bodyClass }}">\r\n'
}

Note: processMetaPattern is generating the pattern correctly.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions