Пример #1
0
def scssToCss(src, dest, importPaths=[]):
  # add import paths
  # imps = []
  # for path in importPaths:
  #   imps.append('-I')
  #   imps.append(path)
  execute(
      'sass', '--compass', '--force', '--update',
      '%s:%s' % (src, dest))
Пример #2
0
def optimizeImage(filepath, compress):
  """
  Optimize path filepath with optimization level.
  """
  # execute('optipng', '-o%d' % level, filepath)
  if compress:
    execute('optipng', '-zc1-9', '-zm1-9', '-zs0-3', '-f0-5', filepath)
  else:
    execute('optipng', '-o0', filepath)
Пример #3
0
def compressJs(src, cssMap, dest, jsMap):
  execute(
      'java', '-jar', settings.CLOSURE_COMPILER,
      # '--compilation_level', 'ADVANCED_OPTIMIZATIONS',
      '--compilation_level', 'SIMPLE_OPTIMIZATIONS',
      # '--warning_level', 'VERBOSE',
      '--process_jquery_primitives',
      #'--variable_map_input_file', jsMap,
      #'--variable_map_output_file',  jsMap,
      #'--js', '/home/dem/bin/closure-library/closure/goog/base.js', src,
      '--js', src,
      '--js_output_file', dest
      )
Пример #4
0
def compressCss(src, mapFilename, dest, compress):
  prepareCss(src)
  execute(
      'java', '-jar', settings.CLOSURE_STYLESHEETS,
      '--allow-unrecognized-properties',
      '--allow-unrecognized-functions',
      '--output-renaming-map-format', 'CLOSURE_UNCOMPILED',
      #'--output-renaming-map-format', 'CLOSURE_COMPILED',
      #'--output-renaming-map-format', 'JSON',
      #'--rename', 'CLOSURE',
      '--output-file', dest,
      '--output-renaming-map', mapFilename,
      src
      )
  optimized = processCss(dest, compress)
  with open(dest, 'w') as f:
    f.write(optimized)
Пример #5
0
def compressXml(src, dest):
  execute(
      'java', '-jar', settings.HTMLCOMPRESSOR, '--type', 'xml',
      '--output', dest, src)
Пример #6
0
def compressHtml(src, dest):
  execute(
      'java', '-jar', settings.HTMLCOMPRESSOR, '--type', 'html',
      '--remove-intertag-spaces', '--remove-surrounding-spaces', 'all',
      '--output', dest, src)