sasstools / scss-tokenizer

A tokenzier for Sass' SCSS syntax
MIT License
24 stars 22 forks source link

[Bug] Error: Unsupported source map encoding charset=utf8;base64 #13

Closed ericnoguchi closed 5 years ago

ericnoguchi commented 7 years ago

I using gulp sass and In node_modules\scss-tokenizer\lib\previous-map.js the below function breaks when encoding is data:application\/json;charset=utf8;base64

This issue stops the whole build process

    PreviousMap.prototype.decodeInline = function decodeInline(text) {
        var uri = 'data:application/json,';
        var base64 = 'data:application/json;base64,';

        if (this.startWith(text, uri)) {
            return decodeURIComponent(text.substr(uri.length));
        } else if (this.startWith(text, base64)) {
            return _jsBase.Base64.decode(text.substr(base64.length));
        } else {
            var encoding = text.match(/data:application\/json;([^,]+),/)[1];
            throw new Error('Unsupported source map encoding ' + encoding);
        }
    };

Maybe a fix similar to https://github.com/postcss/postcss/commit/215ed88db2e6e180f7f07750ddc1540de4ad25d2

ericnoguchi commented 7 years ago

Hi,

Would you like me to submit a pull request for this issue? it is a bit urgent as we now have manually updated the file when doing npm install.

xzyfer commented 7 years ago

Pull requests always welcome. I'm.kn holiday so I haven't looked at the issue.

On 18 May 2017 10:36 pm, "ericnoguchi" notifications@github.com wrote:

Hi,

Would you like me to submit a pull request for this issue? it is a bit urgent as we now have manually updated the file when doing npm install.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sasstools/scss-tokenizer/issues/13#issuecomment-302533936, or mute the thread https://github.com/notifications/unsubscribe-auth/AAjZWF-G_knG6T67LyGdfAICvEn6ZQ-wks5r7KvNgaJpZM4NYPSx .

yavin5 commented 7 years ago

@ericnoguchi Could you please show us what you changed to fix it?

ericnoguchi commented 7 years ago

@yavin5

For now I manually used the same fix for postcss/postcss@215ed88 see my first comment, you will have to do this again if you remove node_modules and reinstall.