MCPcopy
hub / github.com/tdewolff/minify / AddCmdRegexp

Method AddCmdRegexp

minify.go:177–181  ·  view source on GitHub ↗

AddCmdRegexp adds a minify function to the mimetype => function map (unsafe for concurrent use) that executes a command to process the minification. It allows the use of external tools like ClosureCompiler, UglifyCSS, etc. for a specific mimetype regular expression.

(pattern *regexp.Regexp, cmd *exec.Cmd)

Source from the content-addressed store, hash-verified

175// AddCmdRegexp adds a minify function to the mimetype => function map (unsafe for concurrent use) that executes a command to process the minification.
176// It allows the use of external tools like ClosureCompiler, UglifyCSS, etc. for a specific mimetype regular expression.
177func (m *M) AddCmdRegexp(pattern *regexp.Regexp, cmd *exec.Cmd) {
178 m.mutex.Lock()
179 m.pattern = append(m.pattern, patternMinifier{pattern, &cmdMinifier{cmd}})
180 m.mutex.Unlock()
181}
182
183// Match returns the pattern and minifier that gets matched with the mediatype.
184// It returns nil when no matching minifier exists.

Callers 1

TestAddFunction · 0.80

Calls 1

appendFunction · 0.85

Tested by 1

TestAddFunction · 0.64