pattern-lab / plugin-node-tab

ARCHIVED - The Tab plugin allows you to define additional code tabs to the pattern viewer / modal.
http://patternlab.io/
MIT License
5 stars 9 forks source link

support SCSS partial names #20

Closed BMCwebdev closed 7 years ago

BMCwebdev commented 7 years ago

Hi there. I would like to be able to have a partial SCSS file in the folder with, say, an atom button. My Handlebars templates are using the naming convention of; 00-button-base.hbs, 01-button-disabled.hbs, 02-button-secondary.hbs, etc. So in order to get the SCSS code to show up in the tab, I need to name it something like: 00-button-base.scss However, I plan on these small SCSS files being partials that are pulled into a master SCSS file, therefore I would like to be able to name them _00-button-base.scss Any suggestions? Thank you.

BMCwebdev commented 7 years ago

I am attempting to place this into tab-loader.js - however, I would oh so appreciate anyone's input on this who may be more familiar with how Pattern Lab works when it comes to names of files and directories with underscores. (Not sure what I may be breaking by adding this.)


  var patternPath = pattern.relPath;
  var n = patternPath.lastIndexOf("\\");
  var patternPath2 = patternPath.substring(0,n) + "\\" + "_" + patternPath.substring(n + 1);

  //derive the custom filetype paths from the pattern relPath
  var customFileTypePath = path.join(patternlab.config.paths.source.patterns, patternPath2);
BMCwebdev commented 7 years ago

Blërg, got an issue. Windows compile needs to look for lastIndexOf a forward-slash \ whereas a Mac would want the lastIndexOf a backslash / Not sure how or if I want to take care of this.

BMCwebdev commented 7 years ago

Well I am working on a different flow, much easier to change that than trying to wrestle this. Not sure it was a good idea to start with anyhoo. Thanks though.