patternlab-php icon indicating copy to clipboard operation
patternlab-php copied to clipboard

More control over export

Open bradfrost opened this issue 9 years ago • 0 comments

(Not sure which repo to put this, @dmolsen & @bmuenzenmeyer, so I'm putting it here for now.)

I'm running into something that I think could be handled at a lower level. Whenever I run php core/console --export, a few files that I'm only using with Pattern Lab (such as pattern-scaffolding.css) are still referenced in the head of my documented.

I think it would be great if we could wrap these files in a conditional so that when export runs, it switches the conditional off, keeping PL-specific files out of the exported files. For example, _00-head.mustache could look something like this:

<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="../../css/styles.css?{{ cacheBuster }}" media="all" />

{{# patternLabOnly }}

<link rel="stylesheet" href="../../css/pattern-scaffolding.css?{{ cacheBuster }}" media="all" />

<script src="//localhost:35729/livereload.js"></script>

<!-- Other stuff I want to include only in PL but not in my exported code -->

{{/ patternLabOnly }}
</head>
</html>

The same conditional could also be applied in _01-foot.mustache, or better yet, could be applied in any pattern within source/_patterns. This would give people flexibility to do what they need to do within the PL shell, but strip everything out when it gets exported for production.

bradfrost avatar Sep 28 '16 19:09 bradfrost