sindresorhus / grunt-sass

Compile Sass to CSS
MIT License
1.01k stars 209 forks source link

Loosen node-sass dependency requirement to ^3.4.0 #267

Closed mattdsteele closed 8 years ago

mattdsteele commented 8 years ago

This provides similar functionality to that described in https://github.com/sindresorhus/grunt-sass/pull/266, which regressed in a401b042bf5893762ffad2e277100c67f294f65b.

Scenario: I have a project that relies on the deprecated behaviors provided by node-sass@3.4.x. The 3.5.x changes broke this, which were pulled down by grunt-sass. It will take some time to update my code to be compatible.

I resolved this by hardcoding to node-sass@3.4.2 dependency as noted in the above PR. This worked well until grunt-sass@1.2.0 which bumped the node-sass dependency to ^3.7.0. Now npm's deduping no longer applies, as the two dependencies are incompatible, and grunt-sass will always compile with node-sass versions greater than 3.7 regardless of what an app has specified.

As a workaround, I now have to hardcode both grunt-sass@1.1.0 and node-sass@3.4.2. While this works, it's less flexible than loosening the dependency, and contrary to the spirit of "let me choose my own Sass compiler" outlined in the above PR.

This commit should work with both use cases: by default it'll still pull down the latest node-sass in the 3.x range, while still allowing apps that rely on deprecated 3.4 behavior to compile against an earlier version.

danielgheoltan commented 8 years ago

I have the same issue. Hope this will be merged :)

stevenmcdermott8 commented 8 years ago

I am not sure if it is related, but some update has caused this issue when i build using jenkins. Locally the code works

You may not @extend an outer selector from within @media.

 You may only @extend selectors within the same directive.

xzyfer commented 8 years ago

@wondergoat77 this likely due to your Sass being invalid. It may have previously compiled due to a bug in node-sass which has since been solved. You'll need to find the bad @extend and fix it.

You can find more information in https://medium.com/@xzyfer/why-node-sass-broke-your-code-and-semver-1b3e409c57b9#.xkbqzng6a

stevenmcdermott8 commented 8 years ago

The crazy thing is this compiles locally on my computer, but not in a jenkins instance where i am trying to get this to run. all versions of node/npm/grunt are the exact same too.

kevva commented 8 years ago

See https://github.com/sindresorhus/grunt-sass/pull/266.