1
- /*
2
- * patternlab-node - v2.2.1 - 2016
3
- *
1
+ /*
2
+ * patternlab-node - v2.2.1 - 2016
3
+ *
4
4
* Brian Muenzenmeyer, Geoff Pursell, and the web community.
5
- * Licensed under the MIT license.
6
- *
7
- * Many thanks to Brad Frost and Dave Olsen for inspiration, encouragement, and advice.
5
+ * Licensed under the MIT license.
6
+ *
7
+ * Many thanks to Brad Frost and Dave Olsen for inspiration, encouragement, and advice.
8
8
*
9
9
*/
10
10
@@ -340,7 +340,7 @@ var patternlab_engine = function (config) {
340
340
patternType : pattern . patternGroup ,
341
341
patternSubtype : pattern . patternSubGroup
342
342
} ,
343
- patternExtension : pattern . fileExtension ,
343
+ patternExtension : pattern . fileExtension . substr ( 1 ) , //remove the dot because styleguide asset default adds it for us
344
344
patternName : pattern . patternName ,
345
345
patternPartial : pattern . patternPartial ,
346
346
patternState : pattern . patternState ,
@@ -358,15 +358,23 @@ var patternlab_engine = function (config) {
358
358
patternLabFoot : footerPartial
359
359
} ) ;
360
360
361
+ //default the output suffixes if not present
362
+ var outputFileSuffixes = {
363
+ rendered : '' ,
364
+ rawTemplate : '' ,
365
+ markupOnly : '.markup-only'
366
+ }
367
+ outputFileSuffixes = _ . extend ( outputFileSuffixes , patternlab . config . outputFileSuffixes ) ;
368
+
361
369
//write the compiled template to the public patterns directory
362
370
var patternPage = headHTML + pattern . patternPartialCode + footerHTML ;
363
- fs . outputFileSync ( paths . public . patterns + pattern . patternLink , patternPage ) ;
371
+ fs . outputFileSync ( paths . public . patterns + pattern . patternLink . replace ( '.html' , outputFileSuffixes . rendered + '.html' ) , patternPage ) ;
364
372
365
373
//write the mustache file too
366
- fs . outputFileSync ( paths . public . patterns + pattern . patternLink . replace ( '.html' , pattern . fileExtension ) , pattern . template ) ;
374
+ fs . outputFileSync ( paths . public . patterns + pattern . patternLink . replace ( '.html' , outputFileSuffixes . rawTemplate + pattern . fileExtension ) , pattern . template ) ;
367
375
368
376
//write the encoded version too
369
- fs . outputFileSync ( paths . public . patterns + pattern . patternLink . replace ( '.html' , '.markup-only .html') , pattern . patternPartialCode ) ;
377
+ fs . outputFileSync ( paths . public . patterns + pattern . patternLink . replace ( '.html' , outputFileSuffixes . markupOnly + ' .html') , pattern . patternPartialCode ) ;
370
378
371
379
return true ;
372
380
} ) ;
0 commit comments