Pattern Library Utilities

getPatternStyles

method
exports.getPatternStyles()

@param Type Description
patternObject Object metadata from pattern data file (default: pattern.yml)
options Object pattern-importer options

Gets name and type of pattern style file.

exports.getPatternStyles = function (patternObject, options) {
  'use strict';

  if (patternObject[options.cssCompiler]) {
    return createStyleArray(patternObject[options.cssCompiler], options.cssCompiler);
  }
  else {
    return false;
  }
};

createStyleArray

function
createStyleArray()

@param Type Description
styles Array,String array or string of style files
type String type of style files

Checks if styles is an array; creates an array of style files and types

function createStyleArray(styles, type) {
  'use strict';
  var styleArray = [];
  if (Array.isArray(styles)) {
    styles.forEach(function (style) {
      styleArray.push(
        {
          name: style,
          type: type
        }
      );
    });
  }
  else {
    styleArray.push(
      {
        name: styles,
        type: type
      }
    );
  }
  return styleArray;
}