File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed
tools/pfe-tools/dev-server Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -118,22 +118,21 @@ function pfeDevServerPlugin(options: PfeDevServerInternalConfig): Plugin {
118118 ctx . redirect ( `/${ componentSubpath } /${ ctx . params . componentDir } /${ ctx . params . fileName } .ts` ) ;
119119 } )
120120 // Redirect `elements/jazz-hands/demo/*.js|css` to `elements/pf-jazz-hands/demo/*.js|css`
121+ // If request is `elements/jazz-hands/demo/some-other-demo/*.js|css redirect files to `elements/pf-jazz-hands/demo/*.js|css`
121122 . get ( `/${ componentSubpath } /:componentDir/demo/:demoSubDir?/:fileName.:ext` , async ( ctx , next ) => {
122123 if ( ! ctx . params . componentDir . includes ( tagPrefix ) ) {
123- const demoSubDir = ctx . params . demoSubDir ? `${ ctx . params . demoSubDir } /` : '' ;
124- ctx . redirect ( `/${ componentSubpath } /${ tagPrefix } -${ ctx . params . componentDir } /demo/${ demoSubDir } ${ ctx . params . fileName } .${ ctx . params . ext } ` ) ;
124+ ctx . redirect ( `/${ componentSubpath } /${ tagPrefix } -${ ctx . params . componentDir } /demo/${ ctx . params . fileName } .${ ctx . params . ext } ` ) ;
125125 } else {
126126 return next ( ) ;
127127 }
128128 } )
129129 // Redirect `elements/jazz-hands/*` to `elements/pf-jazz-hands/*` for files not previously handled
130130 . get ( `/${ componentSubpath } /:componentDir/:any*` , async ( ctx , next ) => {
131- if ( ctx . params . any === 'demo' ) {
131+ if ( ctx . params . any . includes ( 'demo' ) ) {
132132 /* if its the demo directory return */
133133 return next ( ) ;
134134 }
135135 if ( ! ctx . params . componentDir . includes ( tagPrefix ) ) {
136- console . log ( `redirecting ${ ctx . request . url } to /${ componentSubpath } /${ tagPrefix } -${ ctx . params . componentDir } /${ ctx . params . any } ` ) ;
137136 ctx . redirect ( `/${ componentSubpath } /${ tagPrefix } -${ ctx . params . componentDir } /${ ctx . params . any } ` ) ;
138137 } else {
139138 return next ( ) ;
You can’t perform that action at this time.
0 commit comments