@@ -51,6 +51,7 @@ func newGenCommand() *genCommand {
51
51
lineNumbersInlineStyle string
52
52
lineNumbersTableStyle string
53
53
omitEmpty bool
54
+ omitClassComments bool
54
55
)
55
56
56
57
newChromaStyles := func () simplecobra.Commander {
@@ -81,12 +82,14 @@ See https://xyproto.github.io/splash/docs/all.html for a preview of the availabl
81
82
return err
82
83
}
83
84
84
- var formatter * html.Formatter
85
+ var options [] html.Option
85
86
if omitEmpty {
86
- formatter = html . New ( html .WithClasses (true ))
87
+ options = append ( options , html .WithClasses (true ))
87
88
} else {
88
- formatter = html . New ( html .WithAllClasses (true ))
89
+ options = append ( options , html .WithAllClasses (true ))
89
90
}
91
+ options = append (options , html .WithCSSComments (! omitClassComments ))
92
+ formatter := html .New (options ... )
90
93
91
94
w := os .Stdout
92
95
fmt .Fprintf (w , "/* Generated using: hugo %s */\n \n " , strings .Join (os .Args [1 :], " " ))
@@ -105,6 +108,8 @@ See https://xyproto.github.io/splash/docs/all.html for a preview of the availabl
105
108
_ = cmd .RegisterFlagCompletionFunc ("lineNumbersTableStyle" , cobra .NoFileCompletions )
106
109
cmd .PersistentFlags ().BoolVar (& omitEmpty , "omitEmpty" , false , `omit empty CSS rules` )
107
110
_ = cmd .RegisterFlagCompletionFunc ("omitEmpty" , cobra .NoFileCompletions )
111
+ cmd .PersistentFlags ().BoolVar (& omitClassComments , "omitClassComments" , false , `omit CSS class comment prefixes in the generated CSS` )
112
+ _ = cmd .RegisterFlagCompletionFunc ("omitClassComments" , cobra .NoFileCompletions )
108
113
},
109
114
}
110
115
}
0 commit comments