Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Saving included files doesn't compile main.scss + it compiles itself #68

Closed
artipixel opened this issue Dec 4, 2014 · 18 comments · Fixed by #78
Closed

Saving included files doesn't compile main.scss + it compiles itself #68

artipixel opened this issue Dec 4, 2014 · 18 comments · Fixed by #78
Assignees
Milestone

Comments

@artipixel
Copy link

Hi,
When I'm trying to save some included sass files, it compiles itself, although I specifically disabled this option. additionally, it doesn't compile the main file - main.scss. I need to save 2 files very time I make a change, and I get weird errors as well, like this one -
image
Alltogh there is nothing wrong with that file.
When I'm trying to un-include this file it gives me the same error with the next file.

Also, It's still generating maps - and I specifically disabled it too.
The reason - it calls the full path instead the relative, I'm developing it on my computer and it's not very good to have a path like F:/project/project_name ...
This is my .json file:

{
    "path": {
        "media/scss/main.scss": {
            "sass.enabled": true,
            "sass.options": {
                "outputDir": "../css/",
                "includePaths": [
                    "media/scss/"
                ],
                "imagePath": null,
                "sourceComments": "none",
                "outputStyle": "nested",
                "media/scss/*.scss": {
                    "sass.enabled": false
                }
            }
        }
    }
}

and my folder tree:

│   .brackets.json
│   .htaccess
│   404.html
│   apple-touch-icon-precomposed.png
│   crossdomain.xml
│   favicon.ico
│   humans.txt
│   index.html
│   robots.txt
─media
 ├───css
 │       main.css
 │       main.css.map
 │
 └───scss
     │   main.scss
     │
     ├───core
     │       base.css
     │       base.css.map
     │       base.scss
     │       directional.css
     │       directional.css.map
     │       directional.scss
     │       functions.css
     │       functions.css.map
     │       functions.scss
     │       typography.scss
     │       vars.css
     │       vars.css.map
     │       vars.scss
     │
     ├───normalize
     │       normalize.scss
     │
     ├───pages
     │       common.css
     │       common.css.map
     │       common.scss
     │       painting.scss
     │       school_home.scss
     │
     └───responsive
             grid.css
             grid.css.map
             grid.scss

This is my main.scss file:

@charset "UTF-8";
/*vars*/
@import "core/vars"; 
/*functions*/
@import "core/functions";
/*languages*/
@import "core/directional";
/*normalize*/
@import "normalize/normalize";
/*typography*/
@import "core/typography";
/*base*/ 
@import "core/base";
/*common*/
@import "pages/common";
/*painting page*/
@import "pages/painting"; 
/*home page*/
@import "pages/school_home"; 
/*responsive*/
@import "responsive/grid"; 

The really weird thing is that it saves the file at ../css folder, so the .json file configuration does work.
Help, please? :(

@cosmefae
Copy link

Same problem here. :(
PS.: I realized that just work with "app.scss" to compile the CSS. Another SCSS name doesn't works.

@dennisspohr
Copy link

Same for me, very frustrating. It doesn't recognise any change of imported .scss files.

@WoMayr
Copy link

WoMayr commented Dec 23, 2014

Same problem here.
I even copied the example on the front-page

EDIT: I just tried to enable the compile of the imported files and saw that the app.scss file also gets compiled, but in the wrong directory. So changing the directory to "../css/" helps, but your "scss" directory gets trashed with an additional "css" folder.

@Dexyne
Copy link

Dexyne commented Jan 2, 2015

I'm having a similar issue, when saving my file with import rule it's not working correctly and see the same message as the first post.

  • I try the solution given by @cosmefae because compiling with another name is not working
  • Using app.sass not working too, only SCSS works for me.
  • I try to include in .brackets.json something like this "partials/*.sass": { "sass.enabled": false } but it compile in the same directory and not include anything

So actually all my files inside partials/ use the _name syntax (ex: _component.sass).

Actually my .brackets.json file include this:

"app.scss": {
    "sass.enabled": true,
    "sass.options": {
        "outputDir": "../css/"
    }
}

and my tree looks like this:

css/
    app.css
    app.css.map
sass/
    partials/
        _partial_1.sass
        _partial_2.sass
    app.scss

EDIT: Included files are not watched and compiled inside app.scss if I made a change.
I need to edit app.scss to force the compilation.

@jasonsanjose
Copy link
Owner

@artipixel I think your .brackets.json file is wrong. You're specifying a path media/scss/*.scss inside another path media/scss/main.scss. This is invalid. I think what you want is below:

{
    "sass.enabled": false,
    "path": {
        "media/scss/main.scss": {
            "sass.enabled": true,
            "sass.options": {
                "outputDir": "../css/",
                "includePaths": [],
                "imagePath": null,
                "sourceComments": "none",
                "outputStyle": "nested"
            }
        }
    }
}

However, in addition to the .brackets.json problem, there is a bug here even with the correct JSON where the main file doesn't get compiled. I'll have a fix soon.

@jasonsanjose
Copy link
Owner

Fixed in #78, version 1.0.3-80.

@artipixel Here's an alternative .brackets.json that disabled SASS compiling by default, then enables it just for your root level file:

{
    "sass.enabled": false,
    "path": {
        "media/scss/main.scss": {
            "sass.enabled": true,
            "sass.options": {
                "outputDir": "../css/",
                "includePaths": [],
                "imagePath": null,
                "sourceComments": "none",
                "outputStyle": "nested"
            }
        }
    }
}

@WoMayr
Copy link

WoMayr commented Jan 20, 2015

The last update just made it worse for me. I tried the config you provided here: #68 (comment) but I can't get it to work. (I changed the folder names but everything else is the same)

My folders look like the following:

root
|- css // Output folder of SCSS
|- js
|- ...
|- scss
  |- app.scss
  |- imports
    |- main.scss
    |- layout.scss
    |- ...

My app.scss only consists of "imports" but changing a file in the subfolder "imports" doesn't cause app.scss to recompile.
I also tried the one one the frontpage of this github project. But no luck either.

@jasonsanjose
Copy link
Owner

@Belkar that sample was just for @artipixel. Looking at your example, you'll want a .brackets.json file that looks like this

scss/app.scss
-------------------
@import "main"
@import "layout"
...

.brackets.json
------------------
{
    "sass.enabled": false,
    "path": {
        "scss/app.scss": {
            "sass.enabled": true,
            "sass.options": {
                "outputDir": "../css/",
                "includePaths": ["imports/"],
                "imagePath": null,
                "sourceComments": "none",
                "outputStyle": "nested"
            }
        }
    }
}

@WoMayr
Copy link

WoMayr commented Jan 21, 2015

Thanks for the fast reply but i can't get it to work.
I'm on Windows using your latest version (1.0.4-83)

Saving app.scss works but changing something in imports/*.scss doesn't cause it to recompile
Also i need to specify the folder in app.scss or nothing happens at all.

@import "imports/main"
@import "imports/layout"
...

EDIT: Somehow it works now. (I have done absolutly nothing in between) THANKS!! :)

@artipixel
Copy link
Author

Also thanks,
I will test it as soon as I can,
The website is in production and I had to use an external compiler :(

@panablue
Copy link

I continue to have this issue: saving a partial/imported SCSS file doesn't trigger a recompile of the main SCSS file and update of the live preview.

Here's my .brackets.json:

{
    "sass.enabled": false,
    "path": {

        "scss/master.scss": {
            "sass.enabled": true,
            "sass.options": {
                "output": "../styles.css",
                "includePaths": [],
                "sourceComments": "none",
                "outputStyle": "compressed"
            }
        },

        "scss/potter.scss": {
            "sass.enabled": true,
            "sass.options": {
                "output": "../potter.css",
                "includePaths": [],
                "sourceComments": "none",
                "outputStyle": "compressed"
            }
        }

    }
}

@jasonsanjose jasonsanjose added this to the v2.0 milestone Mar 5, 2015
@jasonsanjose jasonsanjose reopened this Mar 5, 2015
@jasonsanjose
Copy link
Owner

Reopened. @panablue can you try this dev build https://github.com/jasonsanjose/brackets-sass/releases/tag/2.0.1-105 and see if it fixes your issue with partials not recompiling the main input? Also, are you on mac or win?

@panablue
Copy link

panablue commented Mar 5, 2015

It appears to be working - and updating the live preview without saving is extra awesome.

Thank you for taking the time on this. (I'm on Windows 7.)

Maybe not even worth addressing, but I noticed a small anomaly that occurs when making edits between 2 open partial files:

Changes to either file updates the live preview as expected, but saving partial A updates the live preview to show the last-saved version of partial B. (However saving partial B then re-updates the live preview with the changes since the last save.)

@jasonsanjose
Copy link
Owner

@panablue thanks for the feedback.

Maybe not even worth addressing, but I noticed a small anomaly that occurs when making edits between 2 open partial files:

Changes to either file updates the live preview as expected, but saving partial A updates the live preview to show the last-saved version of partial B. (However saving partial B then re-updates the live preview with the changes since the last save.)

Can you file this as a separate bug? Pretty sure that's fixable. Thanks again.

@jasonsanjose
Copy link
Owner

Fixed in #100. Closing

@HumidBrains
Copy link

I get the same problem on Mac as @panablue had on Windows. No live preview and no compiling as soon as I import partials into the app.scss file. Commenting out the imports of partials instantly shows live preview and compiling with file mapping works fine, so it's the imports that breaks it for me. I'm on Yosemite and use brackets-sass v 2.0.1-109. My setup below...

root
|- css // Output folder of SCSS
|- app.css
|- app.css.map
|- scss
|- app.scss
|- imports
|- _variables.scss
|- _graphs.scss
|- ...

scss/app.scss

@import "variables"
@import "graphs"
...

.brackets.json

{
"sass.enabled": false,
"path": {
"scss/app.scss": {
"sass.enabled": true,
"sass.options": {
"outputDir": "../css/",
"includePaths": ["imports/"],
"imagePath": null,
"sourceComments": "none",
"outputStyle": "nested"
}

@TsuNut
Copy link

TsuNut commented Aug 25, 2016

Saving a partial/imported SCSS file doesn't trigger a recompile of the main SCSS file for me neither. :(

Compile works only if I update the main scss file.

@MartinGeldart
Copy link

MartinGeldart commented Jun 27, 2018

Try adding this commented-out line to the top of all of your _partial files:

// main: main.scss

This tells SASS to compile your main SCSS file when saving a partial. Obviously, change main.scss to whichever filename you're using as your main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants