Wscats / compile-hero

🔰Visual Studio Code Extension For Compiling Language
https://marketplace.visualstudio.com/items?itemName=Wscats.qf
MIT License
257 stars 59 forks source link

Do Sass partials (_variables.scss) work? #38

Open JosephStocks opened 4 years ago

JosephStocks commented 4 years ago

I created a Sass partial file called '_variables.scss' that holds the variables.

In my main scss file at the top I use

@import "variables";

When I save the _variables.scss file, Compile Hero creates a new css file called "_variables.css". When I save the main css file, I get this error:

 File to import not found or unreadable: variables.
 Parent style sheet: stdin

It should transpile the variables within the main. It should result in one main file.

I thought the underscore partial syntax was general to all sass compilers. Is it not?

summers173 commented 4 years ago

I was about to report the same, this is a great extension, very useful for testing and demo purposes, to include the ability to compile SCSS partials will be a huge improvement.

Keep the good work and hope this can be addressed, regards.

Wscats commented 4 years ago

@JosephStocks @summers173 I have fixed this problem in the latest version, you can update and use it normally.

summers173 commented 4 years ago

Thanks @Wscats, will give it try, have a nice one

norixx commented 4 years ago

@Wscats You meant the latest ver.2.3.4? There are two versions of Compile Hero extension Pro and Not Pro in market place. Pro version still compiles my partial scss files( Not Pro version works fine :) )

Wscats commented 4 years ago

@Wscats You meant the latest ver.2.3.4? There are two versions of Compile Hero extension Pro and Not Pro in market place. Pro version still compiles my partial scss files( Not Pro version works fine :) )

Not Pro(6.8.65) and Pro(2.3.4). Both versions fix this problem, you can try to update both.

norixx commented 4 years ago

@Wscats Ok, let me rephrase, problem still do exists. Take a look at attached image. imgur

Wscats commented 4 years ago

@Wscats Ok, let me rephrase, problem still do exists. Take a look at attached image. imgur

Thank you so much for the feedback in the video. In your video, there is no problem with your code, but why does it generate an empty file because of this:

$test: red;
@mixin test {
    font-weight: normal;
    font-size: 24px;
    color: $test;
}

Mixins are defined using the @mixin at-rule, which is written @mixin { ... } or @mixin name() { ... }. A mixin’s name can be any Sass identifier, and it can contain any statement other than top-level statements. They can be used to encapsulate styles that can be dropped into a single style rule; they can contain style rules of their own that can be nested in other rules or included at the top level of the stylesheet; or they can just serve to modify variables.

Mixins are included into the current context using the @include at-rule, which is written @include or @include (), with the name of the mixin being included. https://sass-lang.com/documentation/at-rules/mixin

If there is only @mixin a code block, sass cannot generate a meaningful style code snippet. So you can try to rewrite it like this.

$test: red;
@mixin test {
    font-weight: normal;
    font-size: 24px;
    color: $test;
}
.test {
    @include test;
}

The above code will be compiled normally into the following code.

.test {
  font-weight: normal;
  font-size: 24px;
  color: red;
}

Hope it helps you, thank you for your use😁

norixx commented 4 years ago

I am sorry i was short of my words. I @imported _test.scss file into the main scss file (style.scss) and did used @include directive. style.scss was processed fine 👍 I just did not want my _test.scss to become _test.css (I guess it shouldn't). That was all.

Wscats commented 4 years ago

I am sorry i was short of my words. I @imported _test.scss file into the main scss file (style.scss) and did used @include directive. style.scss was processed fine 👍 I just did not want my _test.scss to become _test.css (I guess it shouldn't). That was all.

If you think the plugin can help you solve the problem, please give us a five-star praise. https://marketplace.visualstudio.com/items?itemName=Wscats.eno&ssr=false#review-details

jorgefuertes commented 2 years ago

Same bug with _*.sass files.