meenie / munee

Munee: Standalone PHP 5.3 Asset Optimisation & Manipulation
https://munee.herokuapp.com/
MIT License
833 stars 92 forks source link

SCSS compilation not working #74

Open t-prod opened 9 years ago

t-prod commented 9 years ago

Hi,

I've updated munee to the last version. Unfortunately, the SCSS compilation doesn't work at all. The file is unchanged. I've only the SCSS source.

I'm developing on a local environment with EasyPHP and PHP 5.5 support.

A set_time_limit(0) was necessary cause I have sometimes this error too ?

Fatal error: Maximum execution time of 30 seconds exceeded in vendor\sabberworm\php-css-parser\lib\Sabberworm\CSS\Parser.php on line 313

Here is a classic declaration :

<link rel="stylesheet" href="themes/restart/assets/scss/app.scss,vendor/font-awesome/css/font-awesome.css?minify=true" />

What do you think it is ?

Thanks for your help

meenie commented 9 years ago

@t-prod: It looks like Munee is erroring out when trying to compile. The way Munee works (which was an oversight on my part) is that it takes the original content and caches it. Then when it goes through the process of running it through file types (converting SCSS to CSS) and filters (minifying), it updates that content of the cache. If there is an error, it's not clearing that cache. And when you request it again, it sees that there is a cached version and uses that. Since it errors out and never converts the file, it's serving you the original file. If you delete the cache every time you will notice that it's erroring out every time.

So with all that in mind, do you have any error log files with more information? It looks like the CSS parser I am using is erroring out on your CSS. It would be good to have a backtrace for more info.

t-prod commented 9 years ago

Thanks for your quick answer. I delete the cache and the second error is Fatal error: Maximum execution time of 30 seconds exceeded in vendor\leafo\scssphp\src\Compiler.php on line 1017.

I've added a set_time_limit(0)

In my htaccess I have the classic rule which works with previous versions.:

Munee .htaccess Code Start #### RewriteRule ^(.*\.(?:css|less|scss|js|coffee|jpg|png|gif|jpeg))$ munee.php?files=/$1 [L,QSA,NC] Munee .htaccess Code End ####

It's like the scss is totally ignored. All other CSS files or Javascript work fine. Leafo SCSS is in version 0.1.1 and the compilation with set_time_limit(0) is very very long.

No errors except the fact scss files are ignored.

Any ideas ?

meenie commented 9 years ago

@t-prod: Are you able to work out where in your SCSS this is happening? Start deleting sections and retrying to see what particular part of your SCSS is causing this? Or maybe provide me a copy of your SCSS to see if I can find something?

t-prod commented 9 years ago

Ok I've figured it out. I think is a parsing problem when we work in local. I use the framework Foundation in SASS mode. I simply import the foundation.scss located in my vendor path :

@import "../../../../../vendor/foundation/scss/foundation"; but it displays this when I display the output CSS compilation :

@import url("/localdev/admin/vendor/foundation/scss/foundation/functions"); @charset "UTF-8"; @import url("/localdev/vendor/foundation/scss/components/grid"); @import url("/localdev/vendor/foundation/scss/components/accordion"); @import url("/localdev/vendor/foundation/scss/components/alert-boxes"); @import url("/localdev/vendor/foundation/scss/components/block-grid"); @import url("/localdev/vendor/foundation/scss/components/breadcrumbs"); @import url("/localdev/vendor/foundation/scss/components/button-groups"); @import url("/localdev/vendor/foundation/scss/components/buttons"); @import url("/localdev/vendor/foundation/scss/components/clearing"); @import url("/localdev/vendor/foundation/scss/components/dropdown"); @import url("/localdev/vendor/foundation/scss/components/dropdown-buttons"); @import url("/localdev/vendor/foundation/scss/components/flex-video"); @import url("/localdev/vendor/foundation/scss/components/forms"); @import url("/localdev/vendor/foundation/scss/components/icon-bar"); @import url("/localdev/vendor/foundation/scss/components/inline-lists"); @import url("/localdev/vendor/foundation/scss/components/joyride"); @import url("/localdev/vendor/foundation/scss/components/keystrokes"); @import url("/localdev/vendor/foundation/scss/components/labels"); @import url("/localdev/vendor/foundation/scss/components/magellan"); @import url("/localdev/vendor/foundation/scss/components/orbit"); @import url("/localdev/vendor/foundation/scss/components/pagination"); @import url("/localdev/vendor/foundation/scss/components/panels"); @import url("/localdev/vendor/foundation/scss/components/pricing-tables"); @import url("/localdev/vendor/foundation/scss/components/progress-bars"); @import url("/localdev/vendor/foundation/scss/components/range-slider"); @import url("/localdev/vendor/foundation/scss/components/reveal"); @import url("/localdev/vendor/foundation/scss/components/side-nav"); @import url("/localdev/vendor/foundation/scss/components/split-buttons"); @import url("/localdev/vendor/foundation/scss/components/sub-nav"); @import url("/localdev/vendor/foundation/scss/components/switches"); @import url("/localdev/vendor/foundation/scss/components/tabs"); @import url("/localdev/vendor/foundation/scss/components/thumbs"); @import url("/localdev/vendor/foundation/scss/components/tooltips"); @import url("/localdev/vendor/foundation/scss/components/top-bar"); @import url("/localdev/vendor/foundation/scss/components/type"); @import url("/localdev/vendor/foundation/scss/components/offcanvas"); @import url("/localdev/vendor/foundation/scss/components/visibility");

So the location is wrong where can I correct this ?

meenie commented 9 years ago

I have something in place which rewrites any of the CSS url paths from relative links to absolute for minifying and concatenation purposes. So those @import tags actually shouldn't be rewritten as it runs it through the SCSS compiler and then it goes through and tries to fix any @import tags which are relative to convert to absolute. I think SCSS isn't compiling your template properly. Or it's skipping the @import tags because it can't find the files to import. Are those paths correct?

t-prod commented 9 years ago

Maybe it's more the munee.php at the root. Is there any new config variables in a local environment ?

<?php // Include the composer autoload file define('WEBROOT', __DIR__); require 'vendor/autoload.php'; // Echo out the response echo \Munee\Dispatcher::run(new \Munee\Request());

Locations are right cause I used the last version of Munee (I recheck twice).

meenie commented 9 years ago

Okay. I'm going to give it try myself. Bringing in Foundation and then trying to compile it via Munee. I'll get back to you as soon as I can.

t-prod commented 9 years ago

Thanks again cause I used Foundation and Munee for a while and I never see an error like this ;)

meenie commented 9 years ago

Sorry for the issues! Please use the previous version until I can figure this out.

t-prod commented 9 years ago

Hello,

Do you have any news about this problem ? Have you tested it with Foundation ?

Thanks for your answer