Giter Club home page Giter Club logo

Comments (19)

dlmanning avatar dlmanning commented on May 11, 2024

Any idea if this is a problem with node-sass?

from gulp-sass.

houhr avatar houhr commented on May 11, 2024

I'm not sure, because I don't know how to test UTF-8 comments in node-sass. I'm a node newbie.

What I can provide more in detail is that the gulp-sass can handle Chinese comments in the partial file correctly by using @import command.

from gulp-sass.

apriendeau avatar apriendeau commented on May 11, 2024

Node-sass supports @charset "UTF-8";

from gulp-sass.

dlmanning avatar dlmanning commented on May 11, 2024

@houhr If you could provide a gist or something with a sample of the files that are not working, I'll see if I can figure out how to make them work.

from gulp-sass.

apriendeau avatar apriendeau commented on May 11, 2024

We use @charset "UTF-8"; with gulp-sass and it compiles for our project. You can test it with the node-sass command instead of the sass command.

from gulp-sass.

houhr avatar houhr commented on May 11, 2024

@dlmanning You can use this gist to conduct a test. BTW, by considering other problems of gulp-sass, such as cannot use variables in the comments, we have replace it with gulp-ruby-sass.

from gulp-sass.

houhr avatar houhr commented on May 11, 2024

@apriendeau I've tried put @charset "UTF-8"; at the SCSS file's beginning, but it still didn't work. Could you show me how you did it?

from gulp-sass.

apriendeau avatar apriendeau commented on May 11, 2024

@houhr I trimmed the example down a lot. Our style.scss has a lot more imports and gulp has uglify, concat and some other tasks but this should be enough to do what you need. It is here in this gist.

from gulp-sass.

apriendeau avatar apriendeau commented on May 11, 2024

So I rendered this with node-sass.

/*!
 *  hi there 中文注释 #{$a}
 */

and this with gulp-sass

/*!
 *  hi there -��� #{$a}
 */

so it does look like a bug here or possibly gulp because I believe its happening when the file converts to a string.
https://github.com/dlmanning/gulp-sass/blob/master/index.js#L22

from gulp-sass.

houhr avatar houhr commented on May 11, 2024

@apriendeau It seems we used @charset "UTF-8"; in the same way, and it indeed doesn't work for Chinese comments. Thank you all the same : )

from gulp-sass.

apriendeau avatar apriendeau commented on May 11, 2024

Least we narrowed it down. 👍

from gulp-sass.

dlmanning avatar dlmanning commented on May 11, 2024

Thanks both of you.

This is all gulp-sass does to convert the file buffer to a string:
opts.data = file.contents.toString();

The default encoding format for Buffer.toString() is utf8, so I'm not immediately sure what's going on. Any suggestions?

from gulp-sass.

apriendeau avatar apriendeau commented on May 11, 2024

I tried explicitly setting 'UTF-8' and that didn't work. So I think it might be coming from file.contents, itself. So it very well could be a bug in gulp itself.

from gulp-sass.

dlmanning avatar dlmanning commented on May 11, 2024

Alright, I probably need to write some test cases for vinyl-fs and see if I can pin down what's happening.

from gulp-sass.

kkriehl avatar kkriehl commented on May 11, 2024

This isn't a bug in gulp-sass, but in node-sass. The "render" method of the libsass-binding processes either a scss-file (that happens if you compile a scss file directly with the bin/node-sass cli script) or a scss-string (that's the default case with gulp-sass). In the latter case the success callback function receives the compiled scss code with broken unicode.

from gulp-sass.

athimannil avatar athimannil commented on May 11, 2024

I have the same issue when use content
&:before{ content: "\201C"; } &:after{ content: "\201D" }
CSS begin with @charset "UTF-8"; 😢

from gulp-sass.

Snugug avatar Snugug commented on May 11, 2024

This has been resolved in 2.x. Please try it and report back. If we don't hear back, we'll assume it's been resolved and close this issue.

npm install dlmanning/gulp-sass#2.x

from gulp-sass.

Snugug avatar Snugug commented on May 11, 2024

As it's been a month, I'm closing this.

from gulp-sass.

yohikofox avatar yohikofox commented on May 11, 2024

Hi, i am using "gulp-sass": "^2.3.2", and i still have the issue.

"\f26e" text is still badly transpiled :(

from gulp-sass.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.