comparison piecrust/serving.py @ 240:c1d4e86a3918

less: Generate a proper, available URL for the LESS CSS map file. * The `less` processor now generates a usable URL for map files. * The server can serve files from inside the `_cache` directory.
author Ludovic Chabant <ludovic@chabant.com>
date Sun, 15 Feb 2015 23:29:51 -0800
parents e534d2bc657c
children da5e6e00fb41
comparison
equal deleted inserted replaced
239:f43f19975671 240:c1d4e86a3918
192 192
193 return None 193 return None
194 194
195 def _try_serve_asset(self, environ, request): 195 def _try_serve_asset(self, environ, request):
196 rel_req_path = request.path.lstrip('/').replace('/', os.sep) 196 rel_req_path = request.path.lstrip('/').replace('/', os.sep)
197 full_path = os.path.join(self._out_dir, rel_req_path) 197 if request.path.startswith('/_cache/'):
198 # Some stuff needs to be served directly from the cache directory,
199 # like LESS CSS map files.
200 full_path = os.path.join(self.root_dir, rel_req_path)
201 else:
202 full_path = os.path.join(self._out_dir, rel_req_path)
203
198 try: 204 try:
199 response = self._make_wrapped_file_response( 205 response = self._make_wrapped_file_response(
200 environ, full_path) 206 environ, full_path)
201 return response 207 return response
202 except OSError: 208 except OSError: