def execute(self, assets): for asset in assets: path = asset.full_path if os.path.splitext(path)[1] != '.coffee': yield asset continue # Retrieve cwd from full path file_path = os.path.basename(path) cwd = os.path.dirname(path) # Compile asset output = '' if self._output_dir: output = '--output %s' % self._output_dir pipe('%s --compile %s %s' % (self._executable, output, file_path), cwd=cwd) # Load new asset path = asset.path if self._output_dir: path = os.path.join(os.path.dirname(path), self._output_dir, os.path.basename(path)) path = '%s%s' % (os.path.splitext(path)[0], '.js') output = Asset(path, asset.storage) yield output
def execute(self, assets): for asset in assets: content = asset.read() try: pipe("%s --type=js --verbose" % self._executable, input=content) except PipeError as error: env.log("""Validation failed for asset '%s'""" % asset.path) env.log(error)
def execute(self, assets): for asset in assets: path = asset.full_path if os.path.splitext(path)[1] != ".less": yield asset continue # Retrieve cwd from full path file_path = os.path.basename(path) cwd = os.path.dirname(path) # Assign dependencies self.assign_dependencies(asset) # Get stdout output from less content = pipe("%s %s" % (self._executable, file_path), cwd=cwd) # Create new asset path = asset.path path = "%s%s" % (os.path.splitext(path)[0], ".css") output = Asset(path, asset.storage) output.save(content) yield output
def execute(self, string): content = pipe("%s --type=js --verbose" % self._executable, input=string) return content