File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change 3
3
var patternEngines = require ( './pattern_engines' ) ;
4
4
var path = require ( 'path' ) ;
5
5
var extend = require ( 'util' ) . _extend ;
6
- var cleanHtml = require ( 'js-beautify' ) . html ;
7
6
8
7
// Pattern properties
9
8
@@ -74,7 +73,7 @@ Pattern.prototype = {
74
73
// render function
75
74
render : function ( data , partials ) {
76
75
if ( this . engine ) {
77
- return cleanHtml ( this . engine . renderPattern ( this , data || this . jsonFileData , partials ) ) ;
76
+ return this . engine . renderPattern ( this , data || this . jsonFileData , partials ) ;
78
77
}
79
78
return null ;
80
79
} ,
Original file line number Diff line number Diff line change @@ -14,7 +14,8 @@ var diveSync = require('diveSync'),
14
14
glob = require ( 'glob' ) ,
15
15
_ = require ( 'lodash' ) ,
16
16
path = require ( 'path' ) ,
17
- plutils = require ( './utilities' ) ;
17
+ plutils = require ( './utilities' ) ,
18
+ cleanHtml = require ( 'js-beautify' ) . html ;
18
19
19
20
function buildPatternData ( dataFilesPath , fs ) {
20
21
var dataFiles = glob . sync ( dataFilesPath + '*.json' , { "ignore" : [ dataFilesPath + 'listitems.json' ] } ) ;
@@ -386,13 +387,16 @@ var patternlab_engine = function (config) {
386
387
387
388
//write the compiled template to the public patterns directory
388
389
var patternPage = headHTML + pattern . patternPartialCode + footerHTML ;
390
+ var cleanedPatternPage = cleanHtml ( patternPage ) ;
391
+ var cleanedPatternPartialCode = cleanHtml ( pattern . patternPartialCode ) ;
392
+
389
393
fs . outputFileSync ( paths . public . patterns + pattern . getPatternLink ( patternlab , 'rendered' ) , patternPage ) ;
390
394
391
395
//write the mustache file too
392
396
fs . outputFileSync ( paths . public . patterns + pattern . getPatternLink ( patternlab , 'rawTemplate' ) , pattern . template ) ;
393
397
394
398
//write the encoded version too
395
- fs . outputFileSync ( paths . public . patterns + pattern . getPatternLink ( patternlab , 'markupOnly' ) , pattern . patternPartialCode ) ;
399
+ fs . outputFileSync ( paths . public . patterns + pattern . getPatternLink ( patternlab , 'markupOnly' ) , cleanedPatternPartialCode ) ;
396
400
397
401
return true ;
398
402
} ) ;
You can’t perform that action at this time.
0 commit comments