CodeSleeve / asset-pipeline

This Laravel 4 package provides a very simple and easy to use asset pipeline. It was heavily inspired by the Rails asset pipeline. We make use of the wonderful Assetic package to help with pre-compliation!
http://www.codesleeve.com
MIT License
491 stars 53 forks source link

Templates included as multiple lines instead of single line #190

Open teeli opened 10 years ago

teeli commented 10 years ago

There seems to be an issue, when including templates to scripts, that the templates are included with line breaks instead of single line on some environments.

On my development machine (Windows 7, PHP 5.4.14), the JST templates are correctly on one line, but on my production server (Debian Linux, PHP 5.4.4-14+deb7u11), they are not compiled to single line. This causes a JavaScript error Uncaught SyntaxError: Unexpected token ILLEGAL, because JavaScript does not allow breaking strings on multiple lines.

Examples: dev (working):

JST["templates/scroller"] = "<div class=\"scroller-container\">    <span class=\"scroller-prev\">&lsaquo;</span>    <div class=\"scroller-viewport\">        <div class=\"scroller-wrapper\" ng-transclude></div>    </div>    <span class=\"scroller-next\">&rsaquo;</span></div>";

prod (not working):

JST["templates/scroller"] = "<div class=\"scroller-container\">
    <span class=\"scroller-prev\">&lsaquo;</span>

    <div class=\"scroller-viewport\">
        <div class=\"scroller-wrapper\" ng-transclude></div>
    </div>

    <span class=\"scroller-next\">&rsaquo;</span>
</div>

";

The asset pipeline settings are exactly the same on both envs (concat on, cache off).