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

Update to use Libsass 2.0 #55

Closed
bigandy opened this issue Jun 5, 2014 · 19 comments
Closed

Update to use Libsass 2.0 #55

bigandy opened this issue Jun 5, 2014 · 19 comments

Comments

@bigandy
Copy link

bigandy commented Jun 5, 2014

Libsass has just updated to 2.0 and it would be awesome if the gulp-sass could be updated to use this.

@mcky
Copy link

mcky commented Jun 5, 2014

See #53, waiting on node-sass npm update

mcky added a commit to mcky/gulp-sass that referenced this issue Jun 5, 2014
Updating to libsass 2.0. Closes dlmanning#53, dlmanning#55
@chrisdl
Copy link

chrisdl commented Jun 5, 2014

So theoretically using node-sass 0.9 we should be able to compile .sass files now. Will that "just work" automatically?

gulp.task('sass', function () {
    return gulp.src('sass/file.sass')
        .pipe(sass())
        .pipe(gulp.dest('css'));
});

?

@mcky
Copy link

mcky commented Jun 5, 2014

Using a setup like that and the change I referenced in #56 I get [gulp-sass] source string:1: error: invalid top-level expression with sass files and indentation. Using scss syntax within a file named .sass works regardless of the extension however.

So it doesn't 'just work' by bumping the npm version of node-sass as far as I'm aware, however I don't really know what else is going on behind the scenes so I can't comment on that.

@chrisdl
Copy link

chrisdl commented Jun 5, 2014

I'm seeing the same thing. node-sass seem to be implying it should work "automagically"

sass/node-sass#326

Which made me think it would work auto for gulp-sass as well as it is a wrapper around node-sass.

My heart aches for super fast .sass compilation with libsass via gulp.

@mcky
Copy link

mcky commented Jun 5, 2014

It works perfectly with https://github.com/andrew/node-sass-example (just by bumping to 0.9). Not as simple for upgrading gulp-sass then.

Edit: NVM, wasn't paying attention.

@chrisdl
Copy link

chrisdl commented Jun 5, 2014

So did you have

$font-stack:    Helvetica, sans-serif
$primary-color: #333

body
  font: 100% $font-stack
  color: $primary-color

in a .sass file and you ran it with node-sass (gulp?)? Why would that code output .block... etc?

I got node-sass to process a .sass file with the following. And that worked. So node-sass can def do it (or at least can def do a contrived example).

var sass = require('node-sass');
sass.renderFile({
    file: 'static_source/sass/test.sass',
    success: function (e) {
        console.log("done");
    },
    outFile: 'done.css'
});

@mcky
Copy link

mcky commented Jun 5, 2014

Ooops! My bad, it was using the old code from the scss file before I renamed it. Didn't pay attention to what I was copying.

Glad you got it working though!

@mgreter
Copy link

mgreter commented Jun 5, 2014

I've "documented" the behaviour on sass/libsass#16 (comment). Libsass can only recognise and convert indented sass if it knows it by file extension. If you need to pass it by string, you have to convert it via sass2scss yourself. But I guess this function would need to be exposed by the node-sass binding. I implemented this for the Perl Bindings at mgreter/perl-libsass@7b5bb4f. If you find issues specific to sass2scss please post them to https://github.com/mgreter/sass2scss.

@mcky
Copy link

mcky commented Jun 5, 2014

I'm happy to have it with my curly braces everywhere! Perhaps it's of use for @chrisdl?

@chrisdl
Copy link

chrisdl commented Jun 6, 2014

Oh yeah, If I can get it working with indented syntax I'm gonna be a happy camper. I'll try some stuff and keep you guys updated. But mostly I am wondering why it seems to work with node-sass but not with gulp-sass which should just sit right on top of node-sass?

@mgreter
Copy link

mgreter commented Jun 6, 2014

A wild guess would be that gulp-sass triggers "binding.render(options)" instead of "binding.renderFile(options)"? My test-cases work against the latest libsass.

@dlmanning
Copy link
Owner

Done: 6e88945

@chrisdl
Copy link

chrisdl commented Jun 6, 2014

After updating to 0.7.2 I still cannot compile even a super simple .sass file with gulp-sass. has anyone gotten it working?

@jsheffers
Copy link

Agreed. I am still unable to compile the indented syntax with the latest version.

@idflood
Copy link

idflood commented Jul 1, 2014

With default settings compiling sass files doesn't work. However there is a workaround. If you pass sourceComments: 'normal' as parameter the compilation work. The reason for this is that there is a strange condition which change how file are handled: https://github.com/dlmanning/gulp-sass/blob/master/index.js#L23-L27

Without the sourceComments parameter node-sass or libsass doesn't have access to the file extension since the file content is passed as a string.

Now, I think it's safe to remove this condition and use the same opts.file method for every cases. Here is a pull request regarding this: #66

@chrisdl
Copy link

chrisdl commented Jul 9, 2014

with sourceComments I can now compile it. I put a super simple proof of concept here https://github.com/chrisdl/gulp-libsass-example

@chrisspiegl
Copy link

@idflood's workaround is a great help. If you want to compile sass-style syntax!

@jsheffers
Copy link

@jmm
Copy link

jmm commented Jan 2, 2015

@idflood @chrisdl @cspiegl @jsheffers Just FYI, doing that will result in any changes to the file content from earlier in the gulp pipeline (e.g. earlier plugins) being discarded. See #158.

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

No branches or pull requests

9 participants