noodlehaus/dispatch

Note: .less files aren't accessible due to .htaccess restriction

Closed this issue · 0 comments

More of a note for anyone trying to leverage less.js in the browser for their dev environments. Make this change in your projects root .htaccess file:

<IfModule mod_rewrite.c>
  RewriteEngine on
  # in this case, our app bootstrap file is index.php
  RewriteRule !\.(js|html|ico|gif|jpg|png|css|less)$ index.php 
</IfModule>

Adding |less to your rewrite rule will allow the server to deliver .less files to the browser.


Edit: The same thing goes for any mime types that aren't whitelisted by this rewrite rule.
eg: mp3|mustache|handlebars|json|jpeg|ogg|mp4|wav|wmv etc.

Although the download() function is better suited for media formats, and a proper endpoint that the backend could facilitate for template dumps to ajax requests wouldn't be out of the question.