Comments (19)
Any idea if this is a problem with node-sass?
from gulp-sass.
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.
Node-sass supports @charset "UTF-8";
from gulp-sass.
@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.
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.
@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.
@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.
@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.
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.
@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.
Least we narrowed it down. 👍
from gulp-sass.
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.
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.
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.
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.
I have the same issue when use content
&:before{ content: "\201C"; } &:after{ content: "\201D" }
CSS begin with @charset "UTF-8";
😢
from gulp-sass.
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.
As it's been a month, I'm closing this.
from gulp-sass.
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)
- Could you help update node-sass? HOT 2
- Replace deprecated node-sass with officially supported dart-sass HOT 1
- Dart SASS Options not Working HOT 7
- nevermind
- The following tasks did not complete: sass - Did you forget to signal async completion? HOT 1
- Migrate to the new dart-sass JavaScript API HOT 4
- Quiet option HOT 2
- Can't find stylesheet to import in monorepo HOT 1
- Errors should emit error event HOT 2
- How to include separate css without file concatenation? HOT 2
- Please upgrade ansi-regex to 6.0.1
- 'importers' settings not working to work with '~' replacement, have to choose @mr-hope/gulp-sass
- Why can't I use @use with this? HOT 2
- Inline comments removed after compilation
- Unable to install with ancient version of node.
- support @use
- Wrong autocomplete for outputStyle in vscode
- `render()` and `renderSync()` are deprecated for the `sass` package
- Passing includePath as an array
- Incompatibility with Node 22.0.0 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gulp-sass.