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
489 stars 53 forks source link

Assets in 'production' not working #180

Closed Rukenshia closed 10 years ago

Rukenshia commented 10 years ago

Everything works fine locally. But when trying to use it on our server, the pipeline does not seem to work. I've browsed various forums to find the issue, but the solutions did not work for me. asset-pipeline/config.php is unmodifed.

In bootstrap/start.php:

$env = $app->detectEnvironment(array(

        'local' => array('http://localhost'),
        'production' => array('http://our_production_url'),
));
tjenkinson commented 10 years ago

I had a weird issue when I tries to use bootstrap development CSS and javascript. When it was minified by asset-pipeline it all ended up on one line and some of the styles, including extra ones I added that ended up near the bottom weren't applied. I did a quick search and think browsers might only process up to a certain point on one line. When I give it the production (already minified version) it works fine (and that version is already split onto several lines). It now works so that's the only conclusion I could come to.

If this is the case would it be possible for asset-pipeline to insert line breaks automatically at suitable points?

Cheers, Tom

On 14 Jun 2014, at 10:18, "Jan Christophersen" notifications@github.com wrote:

Everything works fine locally. But when trying to use it on our server, the pipeline does not seem to work. I've browsed various forums to find the issue, but the solutions did not work for me. asset-pipeline/config.php is unmodifed.

In bootstrap/start.php:

$env = $app->detectEnvironment(array(

    'local' => array('http://localhost'),
    'production' => array('http://lcweb.vega.uberspace.de'),

)); — Reply to this email directly or view it on GitHub.

tjenkinson commented 10 years ago

I'm not sure if you've got that config right anyway. If you run "php artisan env" locally and on the server does it return the correct name?

On 14 Jun 2014, at 10:18, "Jan Christophersen" notifications@github.com wrote:

Everything works fine locally. But when trying to use it on our server, the pipeline does not seem to work. I've browsed various forums to find the issue, but the solutions did not work for me. asset-pipeline/config.php is unmodifed.

In bootstrap/start.php:

$env = $app->detectEnvironment(array(

    'local' => array('http://localhost'),
    'production' => array('http://lcweb.vega.uberspace.de'),

)); — Reply to this email directly or view it on GitHub.

Rukenshia commented 10 years ago

php artisan env outputs the correct environment

tjenkinson commented 10 years ago

So it might be the same issue I had then. If you look at the compiled js and css file on the production site are there any really long lines?

Rukenshia commented 10 years ago

Well, the problem is that there are no files. When I manually access /assets via the URL, it gives me error 500.

tjenkinson commented 10 years ago

It should appear wherever you have

<?= stylesheet_link_tag([path to manifest]) ?>
<?= javascript_include_tag([path to manifest]) ?>

in your view.

If you view page source are they not there?

Rukenshia commented 10 years ago

It links to assets/application.css, but when I open that file, I get the internal server error (http://puu.sh/9t5eW/85425522de.png)

tjenkinson commented 10 years ago

Have you got your mod_rewrite set up correctly?

Try going to site.com/index.php/assets/application.css . Does that work?

Rukenshia commented 10 years ago

Try going to site.com/index.php/assets/application.css . Does that work?

that works. For the .htaccess, I've put in the content for "Pretty URLs" from the Laravel page:

Options +FollowSymLinks
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
Rukenshia commented 10 years ago

I've found the issue now. With this .htaccess it works:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

Thanks for your help.