Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def process_file(self, sfile, dpath, dfile):
from rjsmin.rjsmin import jsmin
from rcssmin.rcssmin import cssmin
js_compressor = None
css_compressor = None
if sfile.endswith('.js') and ('.min.' not in sfile and '.pack.' not in sfile) and (self.options.js or self.options.auto):
open(dfile, 'w').write(jsmin(open(sfile).read()))
if self.global_options.verbose:
print 'Compress %s to %s' % (sfile, dfile)
return True
if sfile.endswith('.css') and ('.min.' not in sfile and '.pack.' not in sfile) and (self.options.css or self.options.auto):
open(dfile, 'w').write(cssmin(open(sfile).read()))
if self.global_options.verbose:
print 'Compress %s to %s' % (sfile, dfile)
return True
register_command(ExportStaticCommand)