Hi,
the @import command does only work, when u use the whole path to the file to import. My .scss file to import is in the same directory like the importing one.

@import "importme.scss";
results in:
SassException: Unable to find import file: importme.scss in SassFile::getFile() (Zeile 98 von /[...]/sites/all/modules/sass/phamlp/sass/SassFile.php).

@import "sites/all/themes/theme/css/importme.scss";
is working :-/

Is it possible to tell Sass to look into the same directory for the importing file?

Thank you :)

CommentFileSizeAuthor
#1 parse_all_scss_files-1304090-1.patch879 bytesaxe312

Comments

axe312’s picture

Status: Active » Needs review
StatusFileSize
new879 bytes

Wrong patch! This one does not fix the problem. Just uploaded to the wrong Issue! .. sry

derekwebb1’s picture

Assigned: Unassigned » axe312
Status: Active » Needs review

Subscribing - same issue

anton-zaytsev’s picture

Status: Needs review » Fixed

Thank you for patch!

Just implemented it, expect to see the changes in version 2.01, after drupal.org crawler creates package.
Please let me know if new version wouldn't appears within 24 hours.

axe312’s picture

Status: Fixed » Active

The patch @ #1 was not for this issue. The patch does not fix the problem. I just uploaded the patch to the wrong issue.

#1 was for http://drupal.org/node/1304104

Sry for that!

axe312’s picture

Status: Needs review » Active

I got the solution, but there's a bug in the SassFile.php of PHamlP ... so at this moment I cant fix it :(

Just add:
$SassParser_config['template_location'] = dirname($stylesheet);
Before:
$sass_parser = new SassParser($SassParser_config);

It should work now, but it does'nt :-/

The problem is this line in the SassFile.php of PHamlP:
if (!empty($parser->template_location)) {

This if-strukture will allways fail, because there's a "bug" with the empty() function. Check this out:
http://www.php.net/manual/de/function.empty.php#101988

What to do next? Contact the Author of PHamlP?

Ps.: Iam using the version linked on the sass module page

anton-zaytsev’s picture

ha, just wanted to write that I found solution and found your last post :)
but my solution a little bit different.

I added this line

<?php
$SassParser_config['load_paths'] = array(dirname($stylesheet).'/');
?>

after loop starts

<?php
 foreach ($stylesheets as $stylesheet) {
?>

need to use key "load_paths" as it is created specially for @import directive

An array of filesystem paths which should be searched for Sass templates imported with the @import directive.

Unfortunatly we can't use "load_paths" and "extensions" keys both at this moment, because of the bug in phamlp lib, file SassParser.php line 303-308, if rewrites it to

<?php
empty($options['load_paths']) ? $options['load_paths'] = array($lp) : $options['load_paths'][] = $lp;
empty($options['function_paths']) ? $options['function_paths'] = array($fp) : $options['load_paths'][] = $fp;
?>

than @import directive will works as needed.

anton-zaytsev’s picture

added new version 2.02, where @import has relative to current styles file include path

eu.claudio’s picture

Where can I find such version?

axe312’s picture

@eu.claudio: U can get 7.x-2.2 via git!

Anton what should we do now? Contact the creators of phaml lib?

zymphonies-dev’s picture

first you can create .scss file which you want to import. for that file name start _(underscore)
example: _mixins.scss

and import this file in main .scss file

@import "mixins";

Thanks,

agn’s picture

same issue on Drupal 6.26 (6.x)

illmatix’s picture

So when is version 2.02 coming out? This issue looks 3 months old right now.