def get_command(self): try: if os.name == 'nt': lessc = misc.find_in_path('lessc.cmd') else: lessc = misc.find_in_path('lessc') except IOError: lessc = 'lessc' lesspath = get_resource_path('web', 'static', 'lib', 'bootstrap', 'less') return [lessc, '-', '--no-js', '--no-color', '--include-path=%s' % lesspath]
def get_command(self): try: sass = misc.find_in_path('sass') except IOError: sass = 'sass' return [sass, '--stdin', '-t', 'compressed', '--unix-newlines', '--compass', '-r', 'bootstrap-sass']
def get_command(self): try: sassc = misc.find_in_path('sassc') except IOError: sassc = 'sassc' return [ sassc, '--stdin', '--precision', str(self.precision), '--load-path', self.bootstrap_path, '-t', self.output_style ]
def run_rtlcss(self, source): rtlcss = 'rtlcss' if os.name == 'nt': try: rtlcss = misc.find_in_path('rtlcss.cmd') except IOError: rtlcss = 'rtlcss' cmd = [rtlcss, '-'] try: rtlcss = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE) except Exception: # Check the presence of rtlcss, if rtlcss not available then we should return normal less file try: process = Popen(['rtlcss', '--version'], stdout=PIPE, stderr=PIPE) except (OSError, IOError): _logger.warning( 'You need https://rtlcss.com/ to convert css file to right to left compatiblity. Use: npm install -g rtlcss' ) return source msg = "Could not execute command %r" % cmd[0] _logger.error(msg) self.css_errors.append(msg) return '' result = rtlcss.communicate(input=source.encode('utf-8')) if rtlcss.returncode: cmd_output = ''.join(misc.ustr(result)) if not cmd_output: cmd_output = "Process exited with return code %d\n" % rtlcss.returncode error = self.get_rtlcss_error(cmd_output, source=source) _logger.warning(error) self.css_errors.append(error) return '' rtlcss_result = result[0].strip().decode('utf8') return rtlcss_result
def _get_wkhtmltopdf_bin(): return find_in_path('wkhtmltopdf')