blitzrk / sublime_libsass

Build system for Sass/scss files in Sublime Text 2/3 with no external dependencies
MIT License
18 stars 2 forks source link

Nothing seems to happen #7

Closed jbaf closed 8 years ago

jbaf commented 8 years ago

Hello, it's me again :) Thanks for your work on this. I still have difficulties to make it work though. In fact, I installed it well, selected "libsass(sass)" as build system, created a .libsass.json file at the root of my project and when I hit ctrl + shift + B, nothing seems to happen. my scss files are in "frontoffice/ressources/scss" and my css output in "frontoffice/ressources/css" (that's the path I specified in my conf), but my "main.css" file doesn't seem to change, although I read your troubleshooting documentation to the end.

Could you help me, please ? I really want to get it to work ;)

blitzrk commented 8 years ago

Absolutely.

Are there any errors in the ctrl+` window? You may need to scroll up.

And what are the contents of your .libsass.json?

jbaf commented 8 years ago

Thanks ! Here is the output in sublime console :

Traceback (most recent call last): File "./json/decoder.py", line 198, in JSONObject File "./json/scanner.py", line 63, in _scan_once StopIteration

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Applications/Sublime Text.app/Contents/MacOS/sublimeplugin.py", line 551, in run return self.run(args) File "compile in /Users/graphiste6tk/Library/Application Support/Sublime Text 3/Installed Packages/Libsass Build.sublime-package", line 61, in run File "libsass.project in /Users/graphiste6tk/Library/Application Support/Sublime Text 3/Installed Packages/Libsass Build.sublime-package", line 124, in config_for File "libsass.project in /Users/graphiste6tk/Library/Application Support/Sublime Text 3/Installed Packages/Libsass Build.sublime-package", line 90, in read_config File "./json/init**.py", line 319, in loads File "./json/decoder.py", line 352, in decode File "./json/decoder.py", line 368, in raw_decode File "./json/scanner.py", line 38, in _scan_once File "./json/decoder.py", line 198, in JSONObject File "./json/scanner.py", line 38, in _scan_once File "./json/decoder.py", line 200, in JSONObject ValueError: Expecting object: line 1 column 83 (char 82)

And here is the content of my conf file :

{
    "output_dir": "/frontoffice/ressources/css",
    "options": {
        "style": 'expanded',        // String | Output style: nested/expanded/compact/compressed
        "line-numbers": false,      // Bool   | Emit comments showing original line numbers
        "line-comments": false,     // Bool   | Alias for line-numbers, does not override
        "load-path": false,         // List   | Sass import paths: e.g. [ 'C:\bourbon', 'C:\compass' ]
        "plugin-path": false,       // String | Path to autoload plugins (libsass issue 878)
        "sourcemap": true,         // Bool   | Emit .css.map file for debugging in browser
        "omit-map-comment": false,  // Bool   | Omit comment about .css.map file in .css file
        "precision": false          // Int    | Decimal places for computed values
    }
}

Any idea ?

blitzrk commented 8 years ago

Yep, I think I can guess the problems.

I'll see what I can do about outputting warnings for these things.

Let me know if this fixes the problem.

jbaf commented 8 years ago

Ok so I have changed my conf fil to this :

{
    "output_dir": "frontoffice/ressources/css",
    "options": {
        "style": "expanded",        // String | Output style: nested/expanded/compact/compressed
        "line-numbers": false,      // Bool   | Emit comments showing original line numbers
        "line-comments": false,     // Bool   | Alias for line-numbers, does not override
        "load-path": false,         // List   | Sass import paths: e.g. [ 'C:\bourbon', 'C:\compass' ]
        "plugin-path": false,       // String | Path to autoload plugins (libsass issue 878)
        "sourcemap": true,         // Bool   | Emit .css.map file for debugging in browser
        "omit-map-comment": false,  // Bool   | Omit comment about .css.map file in .css file
        "precision": false          // Int    | Decimal places for computed values
    }
}

And now I get this in my console when I try to build :

b'Error opening output file: No such file or directory\n' error: Failed to compile frontoffice/ressources/scss/main.scss

In fact, I would like the "output_dir" to be relative to my project root (where the file conf is stored). Would that normally be the case with what I do ? Excuse my poor level in the matter. I am but a humble designer :).

Thanks for your help.

blitzrk commented 8 years ago

Yes, the output_dir, if it's a relative path, will be relative to where the .libsass.json is found.

This looks like a bug. I'm guessing that the css directory doesn't exist. The plugin should automatically create it and I'm not sure why it isn't doing so. (You could create it yourself to solve the problem right now, but you shouldn't have to after I fix this bug.)

Can you check for me which version of the plugin you have? I think you can do so by going to remove it, but not selecting it.

And don't be afraid to ask about these things. My goal is to make this plugin as easy to use as possible, so if ever it breaks and doesn't give a good warning, I consider it a bug!

jbaf commented 8 years ago

I have v0.7.7

Well in fact the css directory does exist where I specified it, as I try this on my usual boilerplate project. So it shouldn't have to create it.

I just tried something : set the output_dir to "" and then build my file. And it worked : main.css and main.css.map were successfully created in the directory where main.scss is stored. But as soon as I specity a path to my output_dir, BAM, it fails, whatever the path is... I don't know if this can help you...

blitzrk commented 8 years ago

Very helpful. I think I have an idea of what the problem is now.

blitzrk commented 8 years ago

Actually, this is very strange. I can't reproduce your problem and I can't reason through it. Clearly the right root is found, because changes in your config file are reflected, but the output_dir doesn't seem to be correctly found relative to that root.

Anyway, I've added a debug statement to the latest build. It'll update a few minutes past the hour, so if you could, please restart Sublime in about 10 minutes, see if it says that it's updated to 0.7.10, and then give me the new error message including the line with Command: /.../sassc --sourcemap ... ....

jbaf commented 8 years ago

I finished my day at work 3 hours ago (I'm in France) but I will test that tomorrow as soon as I arrive at the office. Thank you.

blitzrk commented 8 years ago

Okay, cool. In the meantime, I'll try more complex examples and see if I can reproduce this.

jbaf commented 8 years ago

I don't know if it can be related but my project is stored on a NAS, on a local network. I know this caused some issues with compass for some of my colleagues, so maybe it's worth mentioning it. I'll make a test on local storage tomorrow, too.

blitzrk commented 8 years ago

Bet that's it. Python could easily be having problems when trying to make a directory on the NAS. I'll fix this immediately.

Still not sure about why it's outputting files to somewhere other than alongside .libsass.json when "working_dir": "", so I'll leave this issue open until I fix that.

blitzrk commented 8 years ago

Found the bug. Fixing now.

blitzrk commented 8 years ago

Reopen if 0.8.0 doesn't solve your problem, but I'm pretty sure it will.

jbaf commented 8 years ago

Thanks, building my main.css seems to work like a charm. But now I see two other issues.

My project structure is like that :

|-- frontoffice/
|   |
|   |-- scss/
|   |   +-- main.scss
|   |   |-- modules/
|   |   |   +-- news.scss
|   |   |-- partials/
|   |   |   +-- _menu.scss
|   |
|   |-- css/
|   |   +-- main.css
|   |   |-- modules/
|   |   |   +-- news.css
|   |
|-- .libsass.json

My issues are the following :

Any thoughts about that ?

Thank you for the efforts you provide to make it right. That's really kind of you.

blitzrk commented 8 years ago
  1. Can you restart sublime? I can't reproduce this.
  2. I'm starting a new issue for this.
jbaf commented 8 years ago

( I hesitated to create a new issue. Thank you for that ).

For the first problem, I tried to restart sublime, to work in a local folder, (not in the NAS), but nothing changed it.

The weird thing is that if I build a partial that is at the root of my /scss folder, the files @importing it are correctly builded, with all his partials, even those from where I tried to build without success. Even weirder, I tried to build a partial, at the root of my /scss folder, which is @imported in a file stored in a sub-folder of /scss and these files are well builded at the root of /css (which is kind of another problem, as I explained, but at least something does happen).

My wild guess is that perhaps your script has a hard time going back to a parent folder when searching for the main .scss file containing the current partial... Would that be a possibility ?

blitzrk commented 8 years ago

What does your import statement look like?

jbaf commented 8 years ago

It looks like this :

//
//      BASE FILE TO COMPILE
//

// BASE
@import 'base/reset'; // RESET
@import 'outils/keyframes';
@import 'base/flex-grid';
@import 'base/base';
blitzrk commented 8 years ago

The plugin should look for all sass files at .libsass.json's directory and deeper and then check for imports of the partial you're trying to build. (For each directory, it has to recalculate the new relative path to the partial to come up with the right import statement. The problem could be here.) If it finds another partial that imports it, then it also tries to find the files importing that partial to add to the list of files to be compiled.

As long as you're importing scss/partials/_menu.scss from scss/main.scss with @import 'partials/menu'; then it should work fine. I'll look at the code and see if I can glean some insight.

blitzrk commented 8 years ago

Sorry for taking up so much of your time and thank you for helping me test this. I'm sure that by the end of the day everything will be working as expected. (And then this will hopefully be closer to a 1.0)

jbaf commented 8 years ago

No problem. In fact, your plugin I something I look for since some time now. When it wil be working, it will save me time and energy as well as for my developper teammates who are constantly unpleased when they have to work some scss, so I'm glad to help you test this.

blitzrk commented 8 years ago

Glad to hear it'll help your workflow. :)

Alright, so on 0.8.0, I tried everything, but can't reproduce any weird behavior. Are you on Windows? I can test on Windows later tonight.

So for now, what I'd like to do is implement the nested output structure described in the other issue. Then, we'll hope that I sweep up the bug in the midst of my changes. Whenever you get to test 0.9.0, if you still get weird behavior, start a new issue, because at that point, I'll be more sure it's Windows-specific.

Thanks!

jbaf commented 8 years ago

Unfortunately, I work on Mac, and I have that problem as well as my colleagues on windows who spotted the problem first... It doesn't seem to be OS related, i'm afraid.

2016-02-23 16:45 GMT+01:00 Ben Krieger notifications@github.com:

Closed #7 https://github.com/blitzrk/sublime_libsass/issues/7.

— Reply to this email directly or view it on GitHub https://github.com/blitzrk/sublime_libsass/issues/7#event-561837423.

Jaufrey Lafuste Graphiste / Web-designer

blitzrk commented 8 years ago

Okay, I must be missing something when I'm trying to reproduce it. Please feel free to open a new issue with as much detail as you can provide (maybe even include small files) once you try it with 0.9.0 tomorrow. And don't forget to change to the new config format. e.g.

{
    "output": {
        "dir": "office/css",
        "structure": ["nested", "office/scss"]
    },
    "compile": {
        "line-comments": true
    }
}

Thanks!