Skip to content

ishViewportRange doesn't exist in config object provided by PatternLab PHP #63

Closed
@notacouch

Description

@notacouch

My local instance of PatternLab is via a fork of Phase2's drupal starter kit. I was excited to see the recent release of viewport range support in 3.5.0 so had successfully updated this particular dependency via composer.

However, after modifying pattern-lab/config/config.yml, the values were still not respected.

I edited pattern-lab/public/styleguide/js/patternlab-viewer.min.js to see where things were falling apart and added a console.log to observe the value for config. It looks something like this:

{
    cacheBuster: 1495725687,
    defaultPattern: "styleguide-styleguide",
    defaultShowPatternInfo: false,
    ishMaximum: "2600",
    ishMinimum: "240",
    outputFileSuffixes: Object,
    plugins: Object
}

ishViewportRange is not there.

Further investigation, the node packages see it, PHP Pattern Lab sees it... ultimately it seems only exposedOptions manually configured in patternlab-php-core are provided to config in pattern-lab/public/styleguide/data/patternlab-data.js.

See Config.php (2.7.0 is what I am currently using):
https://github.com/pattern-lab/patternlab-php-core/blob/v2.7.0/src/PatternLab/Config.php#L240

		// which of these should be exposed in the front-end?
		self::$options["exposedOptions"] = array();
		self::setExposedOption("cacheBuster");
		self::setExposedOption("defaultPattern");
		self::setExposedOption("defaultShowPatternInfo");
		self::setExposedOption("ishFontSize");
		self::setExposedOption("ishMaximum");
		self::setExposedOption("ishMinimum");
		self::setExposedOption("outputFileSuffixes");
		self::setExposedOption("plugins");

and Builder.php
https://github.com/pattern-lab/patternlab-php-core/blob/v2.7.0/src/PatternLab/Builder.php#L103

		// load and write out the config options
		$config                         = array();
		$exposedOptions                 = Config::getOption("exposedOptions");
		foreach ($exposedOptions as $exposedOption) {
			$config[$exposedOption]     = Config::getOption($exposedOption);
		}
		$output     .= "var config = ".json_encode($config).";\n";

Am I on to something here or is there something up with my setup?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions