11"use strict" ;
22
3- const fs = require ( 'fs-extra' ) ,
4- path = require ( 'path' ) ,
5- fileTypes = require ( './../package.json' ) . fileTypes ;
3+ const fs = require ( 'fs-extra' ) ;
4+ const path = require ( 'path' ) ;
65
76/**
87 * The backend method that is called during the patternlab-pattern-write-end event.
@@ -12,6 +11,9 @@ const fs = require('fs-extra'),
1211 */
1312function findTab ( patternlab , pattern ) {
1413
14+ //read the filetypes from the configuration
15+ const fileTypes = patternlab . config . plugins [ 'plugin-node-tab' ] . options . tabsToAdd ;
16+
1517 //exit if either of these two parameters are missing
1618 if ( ! patternlab ) {
1719 console . error ( 'plugin-node-tab: patternlab object not provided to findTab' ) ;
@@ -28,9 +30,10 @@ function findTab(patternlab, pattern) {
2830
2931 //loop through all configured types
3032 for ( let i = 0 ; i < fileTypes . length ; i ++ ) {
33+ const fileType = fileTypes [ i ] . toLowerCase ( ) ;
3134
32- customFileTypePath = customFileTypePath . substr ( 0 , customFileTypePath . lastIndexOf ( "." ) ) + '.' + fileTypes [ i ] ;
33- var customFileTypeOutputPath = patternlab . config . paths . public . patterns + pattern . getPatternLink ( patternlab , 'custom' , '.' + fileTypes [ i ] ) ;
35+ customFileTypePath = customFileTypePath . substr ( 0 , customFileTypePath . lastIndexOf ( "." ) ) + '.' + fileType ;
36+ var customFileTypeOutputPath = patternlab . config . paths . public . patterns + pattern . getPatternLink ( patternlab , 'custom' , '.' + fileType ) ;
3437
3538 //look for a custom filetype for this template
3639 try {
0 commit comments