Node-sass: outFile not working anymore

Created on 26 Dec 2014  路  5Comments  路  Source: sass/node-sass

Before version 2.0 this worked fine:

sass.renderFile({
  file: 'assets/scss/style.scss',
  outFile: 'assets/css/style.css',
  outputStyle: 'compressed'
});

And with version 2.0 the outFile will be not generated with this code:

sass.render({
  file: 'assets/scss/style.scss',
  outFile: 'assets/css/style.css',
  outputStyle: 'compressed'
});

Most helpful comment

It would be nice to have an example on the readme of compiling scss and writing it to the filesystem as this is the most common use case, especially if a lot of backwards incompatible changes get made. I assumed that outFile means it gets written automatically. I think most people will assume this.

All 5 comments

Please see the Breaking Changes section in release notes.

sass.render({
  file: 'assets/scss/style.scss',
  outFile: 'assets/css/style.css',
  outputStyle: 'compressed',
  success: function(result) {
    // you will need to write result.css to file-system, we just return you a string
    // same goes for result.map
  }
});

Also, in beta2, we might change result.map to string (currently it is returning it as JS object literal).

I don't see a single reference to the success callback on the Github page: https://github.com/sass/node-sass

Four yrs. back it was introduced in v2: https://github.com/sass/node-sass/blob/v2.0.0-beta/README.md#usage. The API was changed again in v3.

It would be nice to have an example on the readme of compiling scss and writing it to the filesystem as this is the most common use case, especially if a lot of backwards incompatible changes get made. I assumed that outFile means it gets written automatically. I think most people will assume this.

I also thought that outFile should work automatically, but in fact I didn't understand what it does at all. I use my own approach

`let writeableStream = fs.createWriteStream("src/css/style.css");
render({file: 'src/css/scss/style.scss'}, (err, result) => {
if(err)
console.error(err);
else
writeableStream.write(result.css)

});`

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bgolubovic picture bgolubovic  路  3Comments

pulkitnandan picture pulkitnandan  路  4Comments

nagyfej picture nagyfej  路  3Comments

amarbham picture amarbham  路  3Comments

Pixelatex picture Pixelatex  路  3Comments