Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comment location issue #63

Closed
vjeux opened this issue May 29, 2017 · 13 comments
Closed

Comment location issue #63

vjeux opened this issue May 29, 2017 · 13 comments

Comments

@vjeux
Copy link

vjeux commented May 29, 2017

@font-face  {
  src: url(if(
    $bootstrap-sass-asset-helper,
    twbs-font-path('#{$icon-font-path}#{$icon-font-name}.eot'),
    '#{$icon-font-path}#{$icon-font-name}.eot'
  ));
}

// Catchall baseclass
.glyphicon {
}

Outputs for the comment

    {
      "raws": {
        "before": "\n\n",
        "inline": true,
        "left": " ",
        "right": "",
        "text": "Catchall baseclass"
      },
      "type": "css-comment",
      "source": {
        "start": {
          "line": 5,
          "column": 1
        },
        "input": {
          "css": "@font-face  {\n  src: url(if(\n    $bootstrap-sass-asset-helper,\n    twbs-font-path('#{$icon-font-path}#{$icon-font-name}.eot'),\n    '#{$icon-font-path}#{$icon-font-name}.eot'\n  ));\n}\n\n// Catchall baseclass\n.glyphicon {\n}\n",
          "id": "<input css 1>"
        },
        "end": {
          "line": 5,
          "column": 21
        }
      },
      "text": "Catchall baseclass"
    },

It says line 5, column 1-21. But this is '#{$icon-font-pa and not // Catchall baseclass.

@vjeux
Copy link
Author

vjeux commented May 29, 2017

This parses correctly for postcss-less fwiw.

@ai
Copy link
Member

ai commented May 29, 2017

Thanks for report. I look into it, when I will return to good Internet at 9 June.

@vjeux
Copy link
Author

vjeux commented May 29, 2017

Enjoy your vacation! I have a workaround in place so it's not super urgent.

@ai
Copy link
Member

ai commented Jun 11, 2017

I am back! :) Very strange, that you got css-comment type, because PostCSS or postcss-scss doesn’t use it. Can you show your JS code?

@ai
Copy link
Member

ai commented Jun 11, 2017

But I found same Comment#source problem in postcss-scss. Main problem is because PostCSS was created with thoughts that url() could not have \n (it is very special token, not just function).

@ai
Copy link
Member

ai commented Jun 11, 2017

Do I understand correctly that url() could not contains \n in normal CSS?
https://www.w3.org/TR/css-syntax-3/#url-token-diagram

In this case we add this hack only for postcss-scss.

@vjeux
Copy link
Author

vjeux commented Jun 11, 2017

I have to say, I have no idea what is happening. I don't understand the CSS spec nor how postcss works to be of help :(

@ai
Copy link
Member

ai commented Jun 11, 2017

OK, tomorrow I will add fix only to postcss-scss :)

@vjeux
Copy link
Author

vjeux commented Jun 11, 2017

postcss-less works fine, so if you fix it here, it'll work well for prettier :) thanks!

@ai
Copy link
Member

ai commented Jun 11, 2017

Done 81f8130

@ai ai closed this as completed Jun 11, 2017
@ai
Copy link
Member

ai commented Jun 11, 2017

I will release it when we get decision for #64

@vjeux
Copy link
Author

vjeux commented Jun 11, 2017

Thanks!

@ai
Copy link
Member

ai commented Jun 11, 2017

Released in 1.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants