Git Product home page Git Product logo

Comments (6)

MohammadYounes avatar MohammadYounes commented on May 20, 2024

but rtlcss only maps back to the Sass' CSS output instead of the original Sass files.

This is the expected behavior, since SASS CSS output is RTLCSS input.

the generated source map file only contains the text "undefined" and the source map itself is inlined as a data URI in the output CSS.

As of postcss 3.0 map.inline is enabled by default, which will cause source maps to be embedded inside the processed file, you need to explicitly set it to false.

 rtlcss([...]).process(css, {
    from: 'ltr.css',
    to:   'rtl.css',
    map: { inline: false },
});

from rtlcss.

wkornewald avatar wkornewald commented on May 20, 2024

but rtlcss only maps back to the Sass' CSS output instead of the original Sass files.

This is the expected behavior, since SASS CSS output is RTLCSS input.

However, the Sass output also contains a source map, so it would be possible to map back to the original source, which makes debugging much easier. Currently we have to grep the whole project because we have lots of small Sass modules. Other tools like Uglify support reusing intermediate source maps, too (e.g. so you can see the original Coffee source instead of some unreadable Coffee compiler output).

As of postcss 3.0 map.inline is enabled by default, which will cause source maps to be embedded inside the processed file, you need to explicitly set it to false.

I forgot to mention, we're using the cli (via a custom build system written in Python). The cli's source map output seems to be broken. If the source map is supposed to be inline, why does it generate a .map file with "undefined"? Otherwise the cli should set inline: false.

from rtlcss.

MohammadYounes avatar MohammadYounes commented on May 20, 2024

so it would be possible to map back to the original source

Sure, but still you need to pass the previous source map too

rtlcss([...]).process(css, {
    from: 'ltr.css',
    to:   'rtl.css',
    map: { 'inline': false, 'prev': previousMap },
});

The cli's source map output seems to be broken. If the source map is supposed to be inline, why does it generate a .map file with "undefined"? Otherwise the cli should set inline: false.

True, the CLI was written prior to postcss 3.0 release, it should be updated to set inline:false.

However, to make sure the fix will solve your problem, can you try running your build with a modified version of the CLI. Just update this line to:

    opt.map = {inline:false, prev:true};

And make sure your config has map:true.

Thanks.

from rtlcss.

MohammadYounes avatar MohammadYounes commented on May 20, 2024

@wkornewald According to my tests, when the processed CSS file contains a reference to an external map file then setting map config option to true is sufficient enough. Otherwise you need to set it to {inline:false}.

from rtlcss.

wkornewald avatar wkornewald commented on May 20, 2024

@MohammadYounes Thanks. I've updated our build system and now it seems to work fine. The only issue left is that apparently on Windows there is a mixture of line endings in the generated css file. The code has \r\n, but the sourceMappingURL annotation comment uses \n.

from rtlcss.

MohammadYounes avatar MohammadYounes commented on May 20, 2024

That's caused by postcss, see this line.

from rtlcss.

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.