@import not working

Ben Domanico's Avatar

Ben Domanico

16 Nov, 2011 11:43 PM

Getting a fatal error when trying to use the @import directive.

My scss looks like this:
@import 'mixins';

and I have _mixins.scss in the same directory as the scss file that is trying to import it. Here is the error:

Fatal error: Uncaught exception 'SassException' with message 'Unable to find import file: mixins' in /var/www/vhosts/appdirect.com/sites/info/system/expressionengine/third_party/sassee/libraries/sass/SassFile.php:95 Stack trace: #0 /var/www/vhosts/appdirect.com/sites/info/system/expressionengine/third_party/sassee/libraries/sass/tree/SassImportNode.php(58): SassFile::getFile('mixins', Object(SassParser)) #1 /var/www/vhosts/appdirect.com/sites/info/system/expressionengine/third_party/sassee/libraries/sass/tree/SassNode.php(329): SassImportNode->parse(Object(SassContext)) #2 /var/www/vhosts/appdirect.com/sites/info/system/expressionengine/third_party/sassee/libraries/sass/tree/SassRootNode.php(66): SassNode->parseChildren(Object(SassContext)) #3 /var/www/vhosts/appdirect.com/sites/info/system/expressionengine/third_party/sassee/libraries/sass/tree/SassRootNode.php(75): SassRootNode->parse(Object(SassContext)) #4 /var/www/vhosts/appdirect.com/sites/info/system/expressionengine/third_party/sassee/libraries/sass/SassParser.php in /var/www/vhosts/appdirect.com/sites/info/system/expressionengine/third_party/sassee/libraries/sass/SassFile.php on line 95

  1. Support Staff 1 Posted by Wouter Vervloet on 16 Nov, 2011 11:57 PM

    Wouter Vervloet's Avatar

    Hi Ben,

    Not sure if this is just a typo, but you're telling it to import 'mixins', but the file is called '_mixins'? Could that be the problem?

    – Wouter

  2. 2 Posted by Ben Domanico on 17 Nov, 2011 12:02 AM

    Ben Domanico's Avatar

    Hi Wouter,

    That's how I've done it in the past, and that's how it's documented on the Sass site:
    http://sass-lang.com/tutorial.html (at the bottom).

    I get the same error when I use "mixins" and "mixins.scss"

  3. Support Staff 3 Posted by Wouter Vervloet on 17 Nov, 2011 01:02 AM

    Wouter Vervloet's Avatar

    What does the {exp:sassee:file} tag look like that you are calling in your template? I'm trying to reproduce it here, but for me it works just fine, even @imports in @imports... it's just like inception.

    – Wouter

  4. 4 Posted by Ben Domanico on 17 Nov, 2011 01:11 AM

    Ben Domanico's Avatar

    {exp:sassee:file file='base-global.scss' sass_path='/var/www/vhosts/domain.com/sites/assets//css/scss/' css_path='/var/www/vhosts/domain.com/sites/assets//css/' css_url='http://assets.appdirect.com/_/css/' output_file='base-global-new.css'}

    Ah, so this might throw a wrench in things. I use a different subdomain to store my template files, css, js...

    So my site is at /var/www/vhosts/domain.com/sites/info/
    But all my assets are in /var/www/vhosts/domain.com/sites/assets/

    Do you think it's not happy going across sites?

    (I do this because i run a bunch of subdomains that all share the same assets, and I wanted to keep them in one place to making working on the site easier. It's kinda a custom MSM setup... sorta)

  5. Support Staff 5 Posted by Wouter Vervloet on 17 Nov, 2011 01:36 AM

    Wouter Vervloet's Avatar

    Now you mention that is actually going "cross site" it might have something to do with the PHP option open_basedir.

    This basically means that PHP is not allowed to include files that are outside of the defined paths for that domain. Could you check if that is the problem?

    – Wouter

  6. Support Staff 6 Posted by Wouter Vervloet on 17 Nov, 2011 02:05 AM

    Wouter Vervloet's Avatar

    Ok, some more news... I've tried a few things and I've managed to reproduce your error, but I don't think I can do anything about it.

    Basically, the @import's are being included relative to the main file, but because that path isn't defined in the open_basedir directive, it can't find the file.

    My guess is: if you add the /assets/.. path to the open_basedir option for all domains, it "should" work.

    – Wouter

  7. 7 Posted by Ben Domanico on 17 Nov, 2011 06:18 AM

    Ben Domanico's Avatar

    Hi Wouter,

    Thanks for your efforts. I'm fairly familiar with open_basedir, I've set it up for all the subdomains on my server. Right now, all subdomain installs of EE save their templates to a central "assets" subdomain. Additionally, I save all uploaded content thru EE to this "Assets" subdomain (I even host a shared EE themes folder there). So I know that is set up properly and working.

    I can't wrap my head around why the @import isn't working if everything else is. Additionally, I think I would be getting a PHP error about open_basedir if that was the cause, and I'm not, only the error I posted above.

    Tomorrow morning I'll test out using sassee and @import all from within the same subdomain and just make sure I can get that to work.

    It feels like when the Scss is compiled, it's making an assumption of the URL of imported scss file... Could it be based on some "document root" variable? I know that Image CE uses a similar variable that I believe is available thru EE. Just a thought.

    Okay, I'll let you know how things go tomorrow, let me know if there is anything else I can help out with or if you have any new thoughts.


  8. Support Staff 8 Posted by Wouter Vervloet on 17 Nov, 2011 08:26 AM

    Wouter Vervloet's Avatar

    The error above is one throw by the library I am using to parse SASS. That library suppresses native PHP errors and serves up its own instead, that is why you don't get the open_basedir error.

    – Wouter

  9. 9 Posted by Ben Domanico on 17 Nov, 2011 03:20 PM

    Ben Domanico's Avatar

    Ah okay, do you know offhand how to let it show normal PHP errors? I want to spend some time debugging and I think they would help.

  10. Support Staff 10 Posted by Wouter Vervloet on 17 Nov, 2011 04:07 PM

    Wouter Vervloet's Avatar

    There is no easy way of turning off the Exception handling apart from editing the library files...

  11. 11 Posted by Ben Domanico on 17 Nov, 2011 05:13 PM

    Ben Domanico's Avatar

    Hey Wouter,

    So this morning things have mysteriously gotten worse. I can't even get errors now (not really sure why...).

    When I try and use an @import, I get no outputted errors, and nothing is returned, the page is just blank.

    Haha, I know this is probably beyond what you want to support, especially for a free plugin, but I thought I would update.

  12. 12 Posted by Ben Domanico on 17 Nov, 2011 05:26 PM

    Ben Domanico's Avatar

    Disregard my last comment, I was logged out of EE, and didn't realize that EE suppresses ALL php errors when logged out (thought it was just EE related errors).

    Anyways, do you ever sleep, Wouter? (That's me saying thank you for all the help)

  13. Support Staff 13 Posted by Wouter Vervloet on 17 Nov, 2011 05:50 PM

    Wouter Vervloet's Avatar

    Was about to suggest logging in, but glad to see you figured it out.

    I do sleep, but I have a few weeks off from my day job, so I have a bit more time to spend on my own stuff.

  14. 14 Posted by Ben Domanico on 17 Nov, 2011 06:17 PM

    Ben Domanico's Avatar

    Alright Wouter,

    I've tried everything I can, I can't figure it out. Thanks again for your help, I understand that it's not really a sassee issue (and I also know my setup is not normal).

    It seems that although open_basedir is set up and working for me, the sass parser isn't happy with that.

    If you're out of ideas we can close this thread and you can get back to enjoying you time off work :)

  15. Support Staff 15 Posted by Wouter Vervloet on 30 Nov, 2011 10:04 PM

    Wouter Vervloet's Avatar

    Hi Ben,

    I've given it quite some thought and I don't think I can solve it from my end as it is probably a server issue.

    So if you don't mind, I'd like to close this thread.

    – Wouter

  16. Wouter Vervloet closed this discussion on 30 Mar, 2012 06:23 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

11 May, 2020 02:18 PM
16 Apr, 2020 06:39 AM
04 Apr, 2020 06:12 PM
30 Mar, 2020 07:50 PM
24 Mar, 2020 05:10 PM