Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pattern Links in "view all" ignore configured outputFilePaths #437

Closed
geoffp opened this issue Aug 17, 2016 · 7 comments
Closed

Pattern Links in "view all" ignore configured outputFilePaths #437

geoffp opened this issue Aug 17, 2016 · 7 comments

Comments

@geoffp
Copy link
Contributor

geoffp commented Aug 17, 2016

I am using Pattern Lab Node v2.4.2 on Mac, with Node v4.4.7, using the Gulp Edition.

Expected Behavior

When using the following config, which supports the use of Underscore templates:

"outputFileSuffixes": {
    "rendered": "-rendered",
    "rawTemplate": "",
    "markupOnly": "-markupOnly"
}

The pattern links in "View All" should end in "-rendered.html".

Actual Behavior

They end in ".html", and in this configuration, that gets you the rawTemplate version and breaks navigation due to the absence of essential scripts on the page in the iframe.

This appears to be due to widespread use of the precomputed patternLink value on Pattern objects. I propose to eliminate this field and replace it with a getPatternLink() method that takes the patternlab object as an argument so it can calculate the correct value on the fly based on the user's config.

@geoffp geoffp self-assigned this Aug 17, 2016
@geoffp geoffp modified the milestone: 2.4.0 Aug 17, 2016
@mbulfair
Copy link

mbulfair commented Aug 17, 2016

I am now seeing this only under each folder, individual view all are working. So for example

  • atoms
    • color
      • colorpattern1
      • colorpattern 2
      • view all (works)
    • text
      • textpattern1
      • textpattern2
      • view all (works)
  • viewall (broke)

@geoffp
Copy link
Contributor Author

geoffp commented Aug 17, 2016

@mbulfair, that's actually a different issue. Mine is that these links don't work:
screen-shot-2016-08-17-at-2 57 39-pm

@bmuenzenmeyer
Copy link
Member

bmuenzenmeyer commented Aug 18, 2016

@geoffp I think what you propose is a good way to address this issue going forward, versus what I've been attempting to do (monkey-patch replace when issues crop up with suffixes)

@bmuenzenmeyer
Copy link
Member

bmuenzenmeyer commented Aug 19, 2016

@mbulfair FWIW this is all working for me right now on dev (probably why I thought this was ready for the big time in general...) can you try again from dev please?

viewall

@bmuenzenmeyer
Copy link
Member

Or, is this only an issue when you deviate from the default outputFileSuffixes.rendered of '' ? That would make more sense, says my rubber ducky.

@bmuenzenmeyer
Copy link
Member

Oh, I see what you are experiencing now after I configure an outputFileSuffix.

I tried monkey-patching ui_builder.js at line 353 with

pattern.patternLink = pattern.patternLink.replace('.html', patternlab.config.outputFileSuffixes.rendered + '.html'); but it did not resolve this issue. I see that patternLink is used in lineage too so doing your more global fix is a better long-term solution anyways

@geoffp
Copy link
Contributor Author

geoffp commented Aug 20, 2016

Yep, you've got it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants